Flutter injecting by ProxyProvider return null. my problem solved, we must use Provider.of(context) on class which defined with ProxyProvider.
1 2 3 4 5 6 7 8 9 10 11 | class RetrievePageSummarizedInformation extends StatesRebuilder { BuiltUserProfile builtUserProfile = BuiltUserProfile(); final WebParserApi _api; RetrievePageSummarizedInformation({@required WebParserApi api}) : _api = api; getPageProfileInfo(String username) async { final res = await _api.getSimpleProfileInformation(username); return res; } } |
injecting solution:
1 | models: [() => RetrievePageSummarizedInformation(api:Provider.of(context))], |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.