isn't defined for the class 'BuildContext - android

How to solve this problem
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/chewie-0.9.10/lib/src/chewie_player.dar
t:276:17: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'Bu
ildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/src/flutter/p
ackages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'inh
eritFromWidgetOfExactType'.
context.inheritFromWidgetOfExactType(_ChewieControllerProvider)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/chewie_audio-1.0.0+1/lib/src/chewie_pla
yer.dart:101:17: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the cl
ass 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/src/flutter/p
ackages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'inh
eritFromWidgetOfExactType'.
context.inheritFromWidgetOfExactType(_ChewieAudioControllerProvider)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^FAILURE: Build failed with an exception.
Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1035
What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
Process 'command 'C:\src\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 1m 56s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 118.6s
Gradle task assembleRelease failed with exit code 1

It seems like you're using an old version of chewie. 0.9.10 is supporting an older version of Flutter. In recent versions of Flutter, inheritFromWidgetOfExactType is deprecated in favor of dependOnInheritedWidgetOfExactType. This issue was fixed in version 0.10.4 of chewie.
Upgrade the version number in your pubspec.yaml. For example to the latest version:
chewie: ^1.2.2

Related

Flutter build issue apk build fail

I am getting the following issue while building the apk :
/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.3.3/lib/src/structs.g.dart:661:31: Error: Member not found: 'UnicodeChar'.
int get UnicodeChar => Char.UnicodeChar;
^^^^^^^^^^^
/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.3.3/lib/src/structs.g.dart:662:38: Error: Setter not found: 'UnicodeChar'.
set UnicodeChar(int value) => Char.UnicodeChar = value;
^^^^^^^^^^^
/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.3.3/lib/src/structs.g.dart:664:29: Error: Member not found: 'AsciiChar'.
int get AsciiChar => Char.AsciiChar;
^^^^^^^^^
/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.3.3/lib/src/structs.g.dart:665:36: Error: Setter not found: 'AsciiChar'.
set AsciiChar(int value) => Char.AsciiChar = value;
^^^^^^^^^
/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_calendar_carousel-1.5.3/lib/flutter_calendar_carousel.dart:424:16: Error: The method 'FlatButton' isn't defined for the c
lass '_CalendarState'.
'_CalendarState' is from 'package:flutter_calendar_carousel/flutter_calendar_carousel.dart' ('/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_calendar_carousel-1.5.3/
lib/flutter_calendar_carousel.dart').
Try correcting the name to the name of an existing method, or defining a method named 'FlatButton'.
child: FlatButton(
^^^^^^^^^^
/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_calendar_carousel-1.5.3/lib/src/calendar_header.dart:46:32: Error: The method 'FlatButton' isn't defined for the class 'C
alendarHeader'.
'CalendarHeader' is from 'package:flutter_calendar_carousel/src/calendar_header.dart' ('/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_calendar_carousel-1.5.3/lib/sr
c/calendar_header.dart').
Try correcting the name to the name of an existing method, or defining a method named 'FlatButton'.
Widget _headerTouchable() => FlatButton(
^^^^^^^^^^
*********************************************************
WARNING: This version of flutter_webview_plugin will break your Android build if it or its dependencies aren't compatible with AndroidX.
See https://docs.flutter.dev/development/platform-integration/android/androidx-migration for more information on the problem and how to fix it.
This warning prints for all Android build failures. The real root cause of the error may be unrelated.
*********************************************************
FAILURE: Build failed with an exception.
Where:
Script 'C:\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159
What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
Process 'command 'C:\flutter\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 1m 20s
Running Gradle task 'assembleRelease'... 81.7s
Gradle task assembleRelease failed with exit code 1
Link to the project source code - https://drive.google.com/drive/folders/1GaNcymRQ1SmQDln-0JpsoEG_9Gy3sOn7?usp=sharing
Please help as soon as possible.
Thank You
By looking at this section of error, your dependencies might not be compatible with AndroidX.
WARNING: This version of flutter_webview_plugin will break your Android build if it or its dependencies aren't compatible with AndroidX.
According to this github issue you need to migrate to AndroidX. To migrate follow these steps -
1 - Open android directory with Android Studio 3.2+.
2 - Click on Refactor then migrate to AndroidX.
After that add these to the gradle.properties file in the android directory.
android.useAndroidX=true
android.enableJetifier=true

Flutter Build Issue

When I try to open the application made with Flutter on the test device, I get the following error. I tried many methods but could not get a successful result. What do you think is the error and how can I resolve it?
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/provider-2.0.1+1/lib/src/provider.dart:179:19: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/src/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 _Provider<T>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/provider-2.0.1+1/lib/src/provider.dart:180:19: Error: The method 'ancestorInheritedElementForWidgetOfExactType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/src/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:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\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
BU�LD FAILED in 2m 0s
Exception: Gradle task assembleDebug failed with exit code 1
It looks like you're using the version 2.0.1 of the Provider Library.
This version isn't compatible with the newest versions of Flutter, since the inheritFromWidgetOfExactType was deprecated in Flutter 1.12
You have two choices here, either downgrade the version of Flutter you're using to be below 1.12, or upgrade your Provider import to a newer one (I strongly recommend you to pick the second option !)
You should try this.
Yesterday I Just restarted my pc and got this issue. I tried to search for the solution to this problem but nothing works in my case.
Solution
Just delete your flutter folder (Flutter Source) and then reinstall it. Your problem will solve.

Error: Type 'TableMetadata' not found | FAILURE: Build failed with an exception

I am new to flutter and I am facing this issue that after cleaning the build (flutter clean) my code stopped working and it is stuck in build failed..
I tried deleting the flutter SDK and doing that process again but still I am getting the same error messages.
I was trying to fix the Firebase login and replaced the 'google-services.json' file and then after these commands flutter [clean build, pub get and pub upgrade] the code is stuck in build.
(this is the error message and the screenshot)
Running Gradle task 'assembleDebug'...
../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.5.1+5/lib/src/widget_factory.dart:60:57: Error: Type 'TableMetadata' not found.
Widget buildTable(BuildMetadata m, TextStyleHtml tsh, TableMetadata data) =>
^^^^^^^^^^^^^
../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.5.1+5/lib/src/internal/layout_grid.dart:7:24: Error: Type 'TableMetadata' not found.
TextStyleHtml tsh, TableMetadata data) {
^^^^^^^^^^^^^
../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.5.1+5/lib/src/widget_factory.dart:60:57: Error: 'TableMetadata' isn't a type.
Widget buildTable(BuildMetadata m, TextStyleHtml tsh, TableMetadata data) =>
^^^^^^^^^^^^^
../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_widget_from_html-0.5.1+5/lib/src/internal/layout_grid.dart:7:24: Error: 'TableMetadata' isn't a type.
TextStyleHtml tsh, TableMetadata data) {
^^^^^^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'D:\Flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 904
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'D:\Flutter\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 6m 10s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 376.2s (!)
Exception: Gradle task assembleDebug failed with exit code 1
I tried to search for this build failed issue but I can't get to fix it.
In your app's pubspec.yaml file look for this line: flutter_widget_from_html and use the version ^ 0.5.1 + 3
Ex: flutter_widget_from_html: ^0.5.1+3
Then click on pub upgrade and run your app
"The easiest fix is to run flutter pub upgrade to make sure both flutter_widget_from_html and flutter_widget_from_html_core is updated together."
Before upgrading pub, you should constrain the newest package version in the pubspec.yaml as flutter_widget_from_html: ^0.5.2
For credit and more info see here

No named parameter with the name error in flutter

When I run my flutter application on android studio this error appear, I did flutter clean and many commands but it didn't work.
Running Gradle task 'assembleDebug'...
/E:/setupfolder/programs/AndroidSDK/flutter/.pub-cache/hosted/pub.dartlang.org/pull_to_refresh-1.6.4/lib/src/smart_refresher.dart:434:9: Error: No named parameter with the name 'keyboardDismissBehavior'.
keyboardDismissBehavior:
^^^^^^^^^^^^^^^^^^^^^^^
/E:/setupfolder/programs/AndroidSDK/flutter/packages/flutter/lib/src/widgets/scroll_view.dart:588:9: Context: Found this candidate, but the arguments don't match.
const CustomScrollView({
^^^^^^^^^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'E:\setupfolder\programs\AndroidSDK\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 904
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'E:\setupfolder\programs\AndroidSDK\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.
Update the version of pull_to_refresh to ^1.6.4 in pubspec.yaml
Downgrade pull_to_refresh to version 1.6.3
It is not compatible with the latest version of flutter
https://github.com/peng8350/flutter_pulltorefresh/issues/424

Flutter error on building files in Android Studio

I have newly installed Flutter on Android Studio. I had a source code of flutter which I want to open using it. I installed the latest flutter plugin and flutter SDK. But when I try to run the app, it shows me the following error:
Compiler message:
/C:/Flutter%20SDK/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.14.4/lib/src/picture_stream.dart:92:3: Error: The superclass, 'Diagnosticable', has no unnamed constructor that takes no arguments.
PictureStream();
^^^^^^^^^^^^^
/C:/Flutter%20SDK/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.14.4/lib/src/picture_stream.dart:192:16: Error: The superclass, 'Diagnosticable', has no unnamed constructor that takes no arguments.
abstract class PictureStreamCompleter extends Diagnosticable {
^
Compiler message:
/C:/Flutter%20SDK/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.14.4/lib/src/picture_stream.dart:92:3: Error: The superclass, 'Diagnosticable', has no unnamed constructor that takes no arguments.
PictureStream();
^^^^^^^^^^^^^
/C:/Flutter%20SDK/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.14.4/lib/src/picture_stream.dart:192:16: Error: The superclass, 'Diagnosticable', has no unnamed constructor that takes no arguments.
abstract class PictureStreamCompleter extends Diagnosticable {
^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Flutter SDK\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 882
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Flutter SDK\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 23s
Exception: Gradle task assembleDebug failed with exit code 1
I am completely new to this and have no idea where this error is pointing. I have the latest Flutter SDK version: Flutter 1.17.0 and Dart 2.8.1, it's a stable version. My Android Studio version is 3.6.2
Try executing this in your terminal :
flutter pub cache repair
If it doesn't work, deleting the flutter folder, along with the cache folder should do the job.
In my case i solved this problem adding the latest version of flutter svg to pubspec.yaml
Check the link to install latest version: https://pub.dev/packages/flutter_svg#-installing-tab-

Categories

Resources