Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: type 'Null' is not a subtype of type 'LoginProvider' in type cast #1

Open
gamzeyilan1 opened this issue Sep 27, 2021 · 1 comment

Comments

@gamzeyilan1
Copy link

gamzeyilan1 commented Sep 27, 2021

Here is the Login Provider:

class LoginProvider extends InheritedWidget {
final bloc = new FormBloc();
LoginProvider({required Key key, required Widget child}) : super(key: key, child: child);
// constructor, forward to Parent InheritedWidget
u/override
bool updateShouldNotify(InheritedWidget _) {
// Todo implantation
return true;
}

static FormBloc of(BuildContext context) {
return (context.dependOnInheritedWidgetOfExactType() as LoginProvider).bloc;
}
}

And on my Login Page, I call that as:

Widget build(BuildContext context) {
final FormBloc formBloc = LoginProvider.of(context);

...

What do I do wrong? Thank you in advance.

@musti-91
Copy link
Member

Hello, I don't see any issue of your implementations.
It was best to mention the error logs.
Something you have to aware of that
(context.dependOnInheritedWidgetOfExactType() as LoginProvider).bloc; is deprecated since then I guess now it got removed.

I don't know if that error is valid. or you still working on the project. sorry for late answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants