CaiJingLong / flutter_load_widget

Apache License 2.0
35 stars 13 forks source link

Fix Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'. #17

Closed mrdev023 closed 3 years ago

mrdev023 commented 3 years ago

When i try to compile i get this error

/C:/tools/flutter/.pub-cache/hosted/pub.dartlang.org/load-0.1.6/lib/src/theme.dart:16:17: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'.
 - 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/tools/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(LoadingTheme);

Because in my version of flutter it's deleted.

I just replace inheritFromWidgetOfExactType by dependOnInheritedWidgetOfExactType recommended in flutter docs

https://api.flutter.dev/flutter/widgets/BuildContext/inheritFromWidgetOfExactType.html

mrdev023 commented 3 years ago

@CaiJingLong

shakir-fattani commented 3 years ago

@CaiJingLong

mrdev023 commented 3 years ago

Patched