dreamsoftin / flutter_wordpress

Flutter WordPress API
https://pub.dartlang.org/packages/flutter_wordpress
MIT License
198 stars 122 forks source link

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

Open chaselifetech opened 4 years ago

chaselifetech commented 4 years ago

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

mymakarim commented 4 years ago

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, ), ), ); }