Skip to content

Commit a7ddc57

Browse files
committed
v3.0.0 - Added null safety support, Dependency updates
1 parent 489ede5 commit a7ddc57

35 files changed

+252
-239
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [3.0.0] - 2021-04-10
2+
3+
* Added null safety support
4+
* Dependency updates
5+
16
## [2.0.0] - 2020-11-18
27

38
* Support for v2.0.0 wp-json-api WordPress plugin

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 2-Clause License
22

3-
Copyright (c) 2020, WooSignal Ltd
3+
Copyright (c) 2021, WooSignal Ltd
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ In your flutter project add the dependency:
2525
``` dart
2626
dependencies:
2727
...
28-
wp_json_api: ^2.0.0
28+
wp_json_api: ^3.0.0
2929
```
3030

3131
### Usage example #
@@ -208,6 +208,6 @@ For help getting started with WooSignal, view our
208208
To use this plugin, add `wp_json_api` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/).
209209

210210
## Note
211-
Install WordPress plugin "WP JSON API" 3.0.x or later for version 2.0.0
211+
Install WordPress plugin "WP JSON API" 3.0.x or later for version 2.0.0+
212212

213213
Disclaimer: This plugin is not affiliated with or supported by Automattic, Inc. All logos and trademarks are the property of their respective owners.

example/main.dart

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class MyApp extends StatelessWidget {
2020
}
2121

2222
class MyHomePage extends StatefulWidget {
23-
MyHomePage({Key key, this.title}) : super(key: key);
23+
MyHomePage({Key? key, required this.title}) : super(key: key);
2424

2525
final String title;
2626

@@ -29,16 +29,16 @@ class MyHomePage extends StatefulWidget {
2929
}
3030

3131
class _MyHomePageState extends State<MyHomePage> {
32-
TextEditingController _tfEmailController;
33-
TextEditingController _tfPasswordController;
32+
late TextEditingController _tfEmailController;
33+
late TextEditingController _tfPasswordController;
3434

3535
@override
3636
void initState() {
3737
super.initState();
3838

3939
// INSTALL THE WP JSON API PLUGIN
4040
// FIRST ON YOUR WORDPRESS STORE
41-
// LINK https://woosignal.com/plugins/wordpress/wpapp-json-api
41+
// LINK https://woosignal.com/plugins/wordpress/wp-json-api
4242

4343
WPJsonAPI.instance.initWith(baseUrl: "http://mysite.com");
4444

@@ -50,14 +50,13 @@ class _MyHomePageState extends State<MyHomePage> {
5050
String email = _tfEmailController.text;
5151
String password = _tfPasswordController.text;
5252

53-
WPUserLoginResponse wpUserLoginResponse;
53+
late WPUserLoginResponse? wpUserLoginResponse;
5454
// LOGIN
5555
try {
5656
wpUserLoginResponse =
57-
await WPJsonAPI.instance.api((request) {
58-
return request.wpLogin(
59-
email: email, password: password, authType: WPAuthType.WpEmail);
60-
});
57+
await WPJsonAPI.instance.api((request) => request.wpLogin(
58+
email: email, password: password, authType: WPAuthType.WpEmail)
59+
);
6160
} on Exception catch (e) {
6261
print(e);
6362
}
@@ -67,9 +66,9 @@ class _MyHomePageState extends State<MyHomePage> {
6766
print(wpUserLoginResponse.data.userId);
6867

6968
// GET USER INFO
70-
WPUserInfoResponse wpUserInfoResponse =
69+
WPUserInfoResponse? wpUserInfoResponse =
7170
await WPJsonAPI.instance.api((request) {
72-
return request.wpGetUserInfo(wpUserLoginResponse.data.userToken);
71+
return request.wpGetUserInfo(wpUserLoginResponse?.data.userToken);
7372
});
7473

7574
if (wpUserInfoResponse != null) {

lib/enums/wp_auth_type.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2020, WooSignal Ltd.
1+
// Copyright (c) 2021, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/enums/wp_meta_data_action_type.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2020, WooSignal Ltd.
1+
// Copyright (c) 2021, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/enums/wp_route_type.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2020, WooSignal Ltd.
1+
// Copyright (c) 2021, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/exceptions/empty_username_exception.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2020, WooSignal Ltd.
1+
// Copyright (c) 2021, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/exceptions/existing_user_email_exception.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2020, WooSignal Ltd.
1+
// Copyright (c) 2021, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

lib/exceptions/existing_user_login_exception.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2020, WooSignal Ltd.
1+
// Copyright (c) 2021, WooSignal Ltd.
22
// All rights reserved.
33
//
44
// Redistribution and use in source and binary forms are permitted

0 commit comments

Comments
 (0)