I am new to flutter, while running the app using flutter run command, it gives me this error.
The following StoreProviderError was thrown building StoreConnector<dynamic, dynamic>(dirty):
I/flutter ( 2958): Error: No StoreProvider<dynamic> found. To fix, please try:
I/flutter ( 2958):
I/flutter ( 2958): * Using Dart 2 (required) by using the --preview-dart-2 flag
I/flutter ( 2958): * Wrapping your MaterialApp with the StoreProvider<State>,
I/flutter ( 2958): rather than an individual Route
I/flutter ( 2958): * Providing full type information to your Store<State>,
I/flutter ( 2958): StoreProvider<State> and StoreConnector<State, ViewModel>
I/flutter ( 2958): * Ensure you are using consistent and complete imports.
I/flutter ( 2958): E.g. always use `import 'package:my_app/app_state.dart';
Can someone help me out to solve this issue.
flutter doctor report:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.5.1, on Microsoft Windows [Version 6.1.7601], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.0)
[√] Android Studio (version 3.1)
[!] VS Code, 64-bit edition (version 1.24.1)
[√] Connected devices (1 available)
Related
I am trying to integrate Firebase Crashlytics into a Flutter app(counter example code). I am getting the above error even after upgrading to Flutter 3.0.0 from Flutter 2.2.1.
Debug Console Output:
/C:/src/fl/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_crashlytics_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:13:11: Error: Method not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace(exception, stackTrace);
^^^^^^^^^^^^^^^^^^^
/C:/src/fl/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_crashlytics_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:16:9: Error: Method not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace(
^^^^^^^^^^^^^^^^^^^
/C:/src/fl/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_crashlytics_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:11:7: Error: A non-null value must be returned since the return type 'Never' doesn't allow null.
Never convertPlatformException(Object exception, StackTrace stackTrace) {
^
3
FAILURE: Build failed with an exception.
* Where:
Script 'C:\src\fl\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1005
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\fl\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 16s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
Flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.0.0, on Microsoft Windows [Version 10.0.22000.675], locale en-IN)
[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[√] Chrome - develop for the web
[X] Visual Studio - develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2021.2)
[√] VS Code (version 1.67.2)
[√] Connected device (4 available)
[√] HTTP Host Availability
! Doctor found issues in 1 category.
Please suggest how to solve this. Thanks.
Try update your version lib to firebase_crashlytics: ^2.8.0
Check and update your sdk to use sdk: ">=2.17.1 <3.0.0" in pubspec.yaml
environment:
sdk: ">=2.17.1 <3.0.0"
Then flutter pub upgrade > flutter clean > flutter pub get
final NotificationSettings settings = await messaging.requestPermission();
I am getting this error when calling requestPermission() method of firebase messaging.
[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: MissingPluginException(No implementation found for method Messaging#requestPermission on channel plugins.flutter.io/firebase_messaging)
E/flutter ( 7180): #0 convertPlatformException (package:firebase_messaging_platform_interface/src/method_channel/utils/exception.dart:13:5)
E/flutter ( 7180): #1 MethodChannelFirebaseMessaging.requestPermission (package:firebase_messaging_platform_interface/src/method_channel/method_channel_messaging.dart:286:13)
E/flutter ( 7180):
In build.gradle i implemented
'com.google.firebase:firebase-messaging'
implementation platform('com.google.firebase:firebase-bom:28.3.0')
I had the same issue. Fixed it updating to the last version:
firebase_core: ^1.10.0
firebase_messaging: ^11.1.0
Use the latest versions of below packages
firebase_core
https://pub.dev/packages/firebase_core/versions
firebase_messaging
https://pub.dev/packages/firebase_messaging/versions
Terminate the current running session.
Do flutter pub get in your terminal
Then run again.
remove onBackgroundmessage from the firebase configure, it's a temporary solution but it works for older firebase packages
Running the flutter app on the web I'm getting an exception only when the login is successful, when the the credentials are wrong the firebase_auth check works properly returning check validation that (Incorrect email address or password, please try again).
Error: MissingPluginException(No implementation found for method Query#observe on channel plugins.flutter.io/firebase_database)
at Object.throw_ [as throw] (http://localhost:18539/dart_sdk.js:5333:11)
at MethodChannel._invokeMethod (http://localhost:18539/packages/flutter/src/services/system_channels.dart.lib.js:954:21)
at _invokeMethod.next (<anonymous>)
at http://localhost:18539/dart_sdk.js:39031:33
at _RootZone.runUnary (http://localhost:18539/dart_sdk.js:38888:58)
at _FutureListener.thenAwait.handleValue (http://localhost:18539/dart_sdk.js:33874:29)
at handleValueCallback (http://localhost:18539/dart_sdk.js:34434:49)
at Function._propagateToListeners (http://localhost:18539/dart_sdk.js:34472:17)
at _Future.new.[_completeWithValue] (http://localhost:18539/dart_sdk.js:34314:23)
at async._AsyncCallbackEntry.new.callback (http://localhost:18539/dart_sdk.js:34337:35)
at Object._microtaskLoop (http://localhost:18539/dart_sdk.js:39175:13)
at _startMicrotaskLoop (http://localhost:18539/dart_sdk.js:39181:13)
at http://localhost:18539/dart_sdk.js:34688:9
So far I've tried the solutions here https://github.com/flutter/flutter/issues/13971 , I/flutter (22027): MissingPluginException(No implementation found for method DocumentReference#setData on channel plugins.flutter.io/cloud_firestore) running
flutter clean
flutter packages get
Also deleting the file
pubspec.lock
And running flutter packages get
This issue occurs only when flutter app is running on the web, on android and iOS devices it runs correctly
Also try to add the firebase_auth_web and firebase_storage_web
Flutter 2.0.4 • channel stable
Framework • revision b1395592de (3 weeks ago) • 2021-04-01 14:25:01 -0700
Engine • revision 2dce47073a
Tools • Dart 2.12.2
# Firebase dependencies
firebase_core: ^0.5.3
firebase_database: ^4.4.0
firebase_auth: ^0.18.4+1
firebase_storage: ^4.0.0
firebase_storage_web:
firebase_messaging: ^7.0.3
Here is where the exception is happening:
#override
Future<FirebaseUser> getCurrentUser() async {
FirebaseUser user = await _firebaseAuth.currentUser();
return user;
}
The exact error is:
Exception has occurred.
PlatformException (PlatformException(error, FirebaseApp with name [DEFAULT] doesn't exist. , null))
My Flutter Doctor Output:
[flutter] flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.17763.914], locale en-US)
• Flutter version 1.12.13+hotfix.5 at D:\src\flutter
• Framework revision 27321ebbad (7 days ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\jcdos\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: D:\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[!] Android Studio (version 3.5)
• Android Studio at D:\Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[!] Connected device
! No devices available
! Doctor found issues in 3 categories.
exit code 0
Here is my debug console:
E/flutter ( 6562): #40 SingleChildRenderObjectElement.mount
package:flutter/…/widgets/framework.dart:5445
E/flutter ( 6562): #41 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3194
E/flutter ( 6562): #42 Element.updateChild
package:flutter/…/widgets/framework.dart:2988
E/flutter ( 6562): #43 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:4243
E/flutter ( 6562): #44 Element.rebuild
package:flutter/…/widgets/framework.dart:3947
E/flutter ( 6562): #
√ Built build\app\outputs\apk\debug\app-debug.apk.
I've tried finding other sources to fix the error, but nothing works. I removed apply plugin: 'com.google.gms.google-services' from the app gradle as that was causing me other issues. And removing this fixed it, as the source I found said it gets called already somewhere else.
And if I keep the com.google.gms.google-services then I get this error which prevents the app from running in the emulator all together:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugGoogleServices'.
> No matching client found for package name 'com.example.testapp
Add below line into your android/app/build.gradle file:
apply plugin: 'com.google.gms.google-services'
Run the application in Android studio it should show some of the errors or files that need to be updated like in the build.gradle files. Also, you need the com.google.gms.google-services for firebase.
when i try another url worked and get json
like: http://api.mp3quran.net/api/surah?surah=1&language=en
but this link not work
link:http://qualityproject-001-site1.ctempurl.com/api/v1/Policy
note: this api built by asp.core
import 'package:http/http.dart';
fetchPost() async {
//http://api.mp3quran.net/api/surah?surah=1&language=en (this work with flutter & flutter_web)
//http://qualityproject-001-site1.ctempurl.com/api/v1/Policy (but this not work with flutter_web and work with flutter)
Response response =
await get('http://qualityproject-001-site1.ctempurl.com/api/v1/Policy');
print(response.body);
}
Flutter crash report; please file at https://github.com/flutter/flutter/issues.
command
flutter run --machine --target lib\main.dart -d chrome --track-widget-creation --start-paused
exception
NoSuchMethodError: NoSuchMethodError: The method 'toJson' was called on null.
Receiver: null
Tried calling: toJson()
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
#1 SourceLocation.toJson (package:vm_service/vm_service.dart:5024:24)
#2 Frame.toJson (package:vm_service/vm_service.dart:3296:47)
#3 Event.toJson (package:vm_service/vm_service.dart:3022:47)
#4 VmServerConnection._delegateRequest.<anonymous closure> (package:vm_service/vm_service.dart:1141:28)
#5 _rootRunUnary (dart:async/zone.dart:1132:38)
#6 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#7 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#8 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#9 _DelayedData.perform (dart:async/stream_impl.dart:591:14)
#10 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:707:11)
#11 _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:667:7)
#12 _rootRun (dart:async/zone.dart:1120:38)
#13 _CustomZone.run (dart:async/zone.dart:1021:19)
#14 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#15 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#16 _rootRun (dart:async/zone.dart:1124:13)
#17 _CustomZone.run (dart:async/zone.dart:1021:19)
#18 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#19 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#20 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#21 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#22 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:116:13)
#23 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:173:5)
flutter doctor
[✓] Flutter (Channel unknown, v1.10.2-pre.40, on Microsoft Windows [Version 10.0.17134.1006], locale en-US)
• Flutter version 1.10.2-pre.40 at C:\flutter\flutter
• Framework revision b4ab5cfe79 (29 hours ago), 2019-09-16 20:34:25 -0700
• Engine revision 7ea9884ab0
• Dart version 2.5.0 (build 2.5.0-dev.4.0 be66176534)
[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at C:\flutter\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = C:\flutter\sdk
• Java binary at: C:\flutter\android-studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b01)
✗ Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.
[✓] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[✓] Android Studio (version 3.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 34.0.1
• Dart plugin version 182.5215
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
[✓] Android Studio (version 3.5)
• Android Studio at C:\flutter\android-studio
• Flutter plugin version 34.0.4
• Dart plugin version 191.6183.88
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b01)
[✓] VS Code (version 1.38.1)
• VS Code at C:\Users\Mahmoud salah eldin\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.4.1
[✓] Connected device (2 available)
• Chrome • chrome • web-javascript • Google Chrome 76.0.3809.132
• Server • web • web-javascript • Flutter Tools
! Doctor found issues in 1 category.
Do the import this way..
import 'package:http/http.dart' as http;
Then
var a = http.get(xyz);