I have a class RedditAPIService where i am putting all the items methods related to DRAW plugin for Reddit.
I created an object for the class in a Stateless widget. (below the class _RedditAuthState extends State portion)
RedditAPIService reddit = RedditAPIService();
I need this reddit object to be available on multiple Widgets downstream so i wanted to use Provider to expose the object:
@override
Widget build(BuildContext context) {
return Provider<RedditAPIService>(
create: (_) => RedditAPIService(),
builder: (context) {
Scaffold(
appBar: GlobalAppBar(
appbarTitle: 'Authorize ReadStories',
),
body: SafeArea(
child: Center(
child: haveRedditAuthCode
? CircularProgressIndicator()
: WebviewScaffold(
url: reddit.getAuthURL(),
hidden: true,
// initialChild: Center(child: Text('data')),
),
)),
);
},
);
}
}
I am currently getting the error:
"error: The argument type 'Null Function(BuildContext)' can't be assigned to the parameter type 'Widget Function(BuildContext, Widget)'."
What am i doing wrong?