Praveen Ezekiel
Praveen Ezekiel

Reputation: 102

Error after installing provider package ^3.1.0 in flutter

I had installed provider package 3.1.0 and had this error while running.

/C:/Users/Praveen/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/delegate_widget.dart:194:18: Error: Superclass has no method named 'inheritFromElement'. return super.inheritFromElement(ancestor, aspect: aspect); ^^^^^^^^^^^^^^^^^^

/C:/Users/Praveen/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:259:19: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'.

/C:/Users/Praveen/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:260:19: Error: The method 'ancestorInheritedElementForWidgetOfExactType' isn't defined for the class 'BuildContext'.

FAILURE: Build failed with an exception.

Process 'command 'D:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1

BUILD FAILED in 23s Exception: Gradle task assembleDebug failed with exit code 1

Upvotes: 0

Views: 842

Answers (1)

Peter Haddad
Peter Haddad

Reputation: 80904

Upgrade to the latest version of provider:

dependencies:
  provider: ^6.0.0

Upvotes: 2

Related Questions