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

Error: Superclass has no method named 'inheritFromElement'. #14

Open
Kevin-Justin opened this issue Mar 8, 2021 · 7 comments
Open

Error: Superclass has no method named 'inheritFromElement'. #14

Kevin-Justin opened this issue Mar 8, 2021 · 7 comments

Comments

@Kevin-Justin
Copy link

What should I do?

@Kevin-Justin
Copy link
Author

/C:/flutter/.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:/flutter/.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'.

  • 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/flutter/packages/flutter/lib/src/widgets/framework.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'inheritFromWidgetOfExactType'.
    ? context.inheritFromWidgetOfExactType(type) as InheritedProvider
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    /C:/flutter/.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'.
  • 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/flutter/packages/flutter/lib/src/widgets/framework.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'ancestorInheritedElementForWidgetOfExactType'.
    : context.ancestorInheritedElementForWidgetOfExactType(type)?.widget
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

FAILURE: Build failed with an exception.

  • Where:
    Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991

  • What went wrong:
    Execution failed for task ':app:compileFlutterBuildDebug'.

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

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

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

@Kevin-Justin Kevin-Justin changed the title error: The named parameter 'vsync' isn't defined. (undefined_named_parameter at [flutter_music_app] lib\ui\page\player_page.dart:30) Error: Superclass has no method named 'inheritFromElement'. Mar 9, 2021
@ershat-dl
Copy link

same problem,not resolved yet,
my flutter is 2.0,
and I could not find any information about flutter version of this application

@abolfazlMKazemi
Copy link

hi
solve this problem
change provider: ^3.0.0+1 to provider: ^4.0.0+1 pubspec.yaml file and run command flutter upgrade

and flutter pub upgrade

@redouan-da
Copy link

@viramaham73 Not working, I got this error : The name 'SingleChildCloneableWidget' isn't a type so it can't be used as a type argument.

@yitianljt
Copy link

@viramaham73 Not working, I got this error : The name 'SingleChildCloneableWidget' isn't a type so it can't be used as a type argument.
SingleChildCloneableWidget-> SingleChildStatelessWidget

@marvinIsSacul
Copy link

After updating the provider package to ^4.0.0+1 I got the following error when running flutter run:

lib/config/provider_manager.dart:8:6: Error: Type 'SingleChildCloneableWidget' not found.
List<SingleChildCloneableWidget> providers = [                          
     ^^^^^^^^^^^^^^^^^^^^^^^^^^                                         
lib/config/provider_manager.dart:14:6: Error: Type 'SingleChildCloneableWidget' not found.
List<SingleChildCloneableWidget> independentServices = [                
     ^^^^^^^^^^^^^^^^^^^^^^^^^^                                         
lib/config/provider_manager.dart:32:6: Error: Type 'SingleChildCloneableWidget' not found.
List<SingleChildCloneableWidget> uiConsumableProviders = [              
     ^^^^^^^^^^^^^^^^^^^^^^^^^^                                         
lib/config/provider_manager.dart:8:6: Error: 'SingleChildCloneableWidget' isn't a type.
List<SingleChildCloneableWidget> providers = [                          
     ^^^^^^^^^^^^^^^^^^^^^^^^^^                                         
lib/config/provider_manager.dart:14:6: Error: 'SingleChildCloneableWidget' isn't a type.
List<SingleChildCloneableWidget> independentServices = [                
     ^^^^^^^^^^^^^^^^^^^^^^^^^^                                         
lib/config/provider_manager.dart:32:6: Error: 'SingleChildCloneableWidget' isn't a type.
List<SingleChildCloneableWidget> uiConsumableProviders = [              
     ^^^^^^^^^^^^^^^^^^^^^^^^^^                                         
                                                                        
                                                                        
FAILURE: Build failed with an exception.                                
                                                                        
* Where:                                                                
Script '/home/marvin/snap/flutter/common/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 991
                                                                        
* What went wrong:                                                      
Execution failed for task ':app:compileFlutterBuildDebug'.              
> Process 'command '/home/marvin/snap/flutter/common/flutter/bin/flutter'' finished with non-zero exit value 1
                                                                        
* Try:                                                                  
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
                                                                        
* Get more help at https://help.gradle.org                              
                                                                        
BUILD FAILED in 12s                                                     
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                        13.0s
Exception: Gradle task assembleDebug failed with exit code 1

@Gursewak-Uppal
Copy link

The SingleChildCloneableWidget interface is removed, and replaced by a SingleChildWidget interface.

Try

import 'package:provider/single_child_widget.dart';

And Replace

List<SingleChildCloneableWidget> independentServices
with

List<SingleChildWidget> independentServices

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

7 participants