flutter_wordpress icon indicating copy to clipboard operation
flutter_wordpress copied to clipboard

I/flutter ( 7592): type '(dynamic, dynamic) => Null' is not a subtype of type '(dynamic) => dynamic' of 'f'

Open chaselifetech opened this issue 4 years ago • 1 comments

Im getting this error: I/flutter ( 7592): type '(dynamic, dynamic) => Null' is not a subtype of type '(dynamic) => dynamic' of 'f'

I believe it is happening on the login.dart section when you click on the login button.

Lind regards David

chaselifetech avatar Apr 13 '20 15:04 chaselifetech

Please follow my instructions, hopefully it solves your problem😊

  1. use JWT Authentication for WP REST API You can install it as a plugin
  2. In login.dart Find the following code and replace baseUrl with your website URL and YOUR_USERNAME as adminName

wordPress = wp.WordPress( baseUrl: 'http://localhost', authenticator: wp.WordPressAuthenticator.JWT, adminName: '', adminKey: '', );

  1. Find _onValidUser() and replace the function with the following

void _onValidUser(wp.WordPress wordPress, wp.User user) { Navigator.pushReplacement( context, MaterialPageRoute( builder: (context) => PostListPage( wordPress: wordPress, user: user, ), ), ); }

mymakarim avatar Apr 18 '20 19:04 mymakarim