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

The method 'ancestorWidgetOfExactType' isn't defined for the type 'BuildContext'. #2

Open
aburcheri opened this issue Apr 6, 2021 · 2 comments

Comments

@aburcheri
Copy link

In the bloc_provider.dart file there is an error at:

BlocProvider provider = context.ancestorWidgetOfExactType(type);

How to solve this?

@ericgrandt
Copy link
Owner

ericgrandt commented Apr 8, 2021

What version of Flutter are you using? This project was made against an older version of Flutter, so if you're using a newer version, there is a chance the function is now deprecated and replaced with something else.

Try replacing it with the following:

BlocProvider provider = context.findAncestorWidgetOfExactType<type>()

@boimseu
Copy link

boimseu commented Oct 13, 2021

Hi, I got the same error, after I replaced with this
BlocProvider provider = context.findAncestorWidgetOfExactType<type>()

got this problems on < type >

Too many positional arguments: 0 expected, but 1 found.
Try removing the extra arguments.

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

3 participants