Flutter custom native plugin conflicts with project code - flutter

For the Flutter app I’m working on, the company had a third party develop native Android and iOS code for an alarm to integrate into our app. I ran their sample app that they made and it ran just fine.
I copied the code over to my project and kept getting this error.
E/flutter (17290): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: MissingPluginException(No implementation found for method alarmStatus on channel samples.flutter.dev/alarmStatus)
E/flutter (17290): #0 MethodChannel._invokeMethod
E/flutter (17290): #1 _MyHomePageState._getAlarmStatus
E/flutter (17290): <asynchronous suspension>
E/flutter (17290):
E/flutter (17290): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: MissingPluginException(No implementation found for method alarmStatus on channel samples.flutter.dev/alarmStatus)
E/flutter (17290): #0 MethodChannel._invokeMethod
E/flutter (17290): <asynchronous suspension>
E/flutter (17290): #1 _MyHomePageState._getAlarmStatus
E/flutter (17290): <asynchronous suspension>
E/flutter (17290):
So, I created a new project and copied the code over and it worked great. While doing some troubleshooting, we found out that this issue sometimes appears with dependencies having issues with each other, so I copied all my dependencies from my app to the new project and got the same error. After commenting out dependencies to find which one may be causing the issue, I landed at the audio_service package. We did some more searching through forums and all, but weren’t able to figure out a solution.
Has anyone run into this issue before and been able to figure out what’s going on? Or have any ideas of what I can try?
I got the recommendation of having the other developers redo the native stuff with a different dependency, but I'm hoping to avoid that if possible.

Related

Showing error when finding near by device in bluetooth using "esc_pos_bluetooth" in flutter

Showing this error when running in esc_pos_bluetooth in flutter i added permission in manifest page but still same error.
> I/flutter (26677): Error starting scan. E/flutter (26677): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] E/flutter (26677): #0 BluetoothManager.scan (package:flutter_bluetooth_basic/src/bluetooth_manager.dart:85:7) E/flutter (26677): <asynchronous suspension>

Flutter error "dart_vm_initializer.cc" Unhandled Exception: 'dart:ui/platform_dispatcher.dart'

I had to reinstall Flutter, Android Studio, Sdk, recreate phone emulator, recreate all my Flutter project because time passes and problems and framework bugs pile up. To keep updated all the Flutter environment without problems seems to be impossible. All the things becomes unstable when new and new Flutter and/or Sdk versions come out.
So I reinstalled everything to have a new, perfectly working environment.
Well, now I have a new, never seen, error:
E/flutter ( 3692): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'dart:ui/platform_dispatcher.dart': Failed assertion: line 1840 pos 15: '<optimized out>': is not true.
E/flutter ( 3692): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
E/flutter ( 3692): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
E/flutter ( 3692): #2 new Locale.fromSubtags (dart:ui/platform_dispatcher.dart:1840:15)
E/flutter ( 3692): #3 PlatformDispatcher._updateLocales (dart:ui/platform_dispatcher.dart:762:29)
E/flutter ( 3692): #4 _updateLocales (dart:ui/hooks.dart:64:31)
E/flutter ( 3692):
My app works, but how can I get rid of that bug?

Flutter share_plus is not working and getting error [duplicate]

I am trying to use the plugin
_launchURL(url) async {
await launch("www.google.com");
}
I have put "www.google.com" just for debugging purposes.
The error I get is MissingPluginException :
E/flutter ( 8299): MissingPluginException(No implementation found for method launch on channel plugins.flutter.io/url_launcher)
E/flutter ( 8299): #0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:278:7)
E/flutter ( 8299): <asynchronous suspension>
E/flutter ( 8299): #1 launch (package:url_launcher/url_launcher.dart:47:19)
E/flutter ( 8299): #2 _launchURL (file:///Users/matejsimunic/Work/dart/suhail/lib/main.dart:834:9)
E/flutter ( 8299): <asynchronous suspension>
E/flutter ( 8299): #3 _TripDetailBodyState.build.<anonymous closure> (file:///Users/matejsimunic/Work/dart/suhail/lib/main.dart:818:19)
E/flutter ( 8299): #4 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:494:14)
E/flutter ( 8299): #5 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:549:30)
E/flutter ( 8299): #6 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
E/flutter ( 8299): #7 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:161:9)
E/flutter ( 8299): #8 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:94:7)
E/flutter ( 8299): #9 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:315:9)
E/flutter ( 8299): #10 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12)
E/flutter ( 8299): #11 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:11)
E/flutter ( 8299): #12 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:143:19)
E/flutter ( 8299): #13 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:121:22)
E/flutter ( 8299): #14 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:101:7)
E/flutter ( 8299): #15 _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:64:7)
E/flutter ( 8299): #16 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:48:7)
E/flutter ( 8299): #17 _invoke1 (dart:ui/hooks.dart:134:13)
E/flutter ( 8299): #18 _dispatchPointerDataPacket (dart:ui/hooks.dart:91:5)
restarting the app from ide doesn't work.
If you are using hot restart or hot reload, it won't do the trick.
Since Flutter has to inject plugin dependencies into the platform-specific parts of your app, hot restart/hot reload is not enough to trigger the injection.
Check this issue for more.
Close the app and execute flutter run command.
flutter clean
Inside the console did the job as stated here
I faced this Error when using Url_launcher package. just had to stop and run the app, issue got solved
Simply Run these commands..
either--
Flutter clean
or
Invalidate Caches/Restart
Had problem while using flutter toast dependency and dependencies like facebook_login. I followed these steps and resolved it:
First, u need to test whether these toast and shared preference dependencies are causing problems or some other dependencies cause the problem.
For testing that, u need to create a new seprate flutter project having the same flutter toast and shared preference dependency and check now if u r able to get toasts or not.
If u r getting toast so there is no problem with ur toast dependency.
The problem might be in ur one of the social media dependency.
In my case, I followed the above steps and found that problem was in facebook dependency. Finally, I found that I did not provide details of my app at facebook developer console. So implemented that and my app was fine.
In my case it was for the cached_network_image plugin , I have removed cached_network_image from pubspec.yaml and replaced the implementation with Image.network and the problem has disappeared
In my case, I had this problem with the image picker, then I followed the documentation and used an emulator with api 29+, it didn't work before because I was using an emulator with api 28 https://pub.dev/packages/image_picker
Uninstalling and installing the app works for me
just open terminal and
step1 flutter clean
step2 flutter pub get
step3 flutter run
Its worked for me,
Thanks have a good day .
i think if you have already done flutter pub get on the dependency, and added all the requirements for the given platform you just have to flutter run your app

MissingPluginException(No implementation found for method pickImage on channel plugins.flutter.io/image_picker)

Unhandled Exception: MissingPluginException(No implementation found for method pickImage on channel plugins.flutter.io/image_picker)
E/flutter (16028): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:159:7)
E/flutter (16028): <asynchronous suspension>
E/flutter (16028): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:334:12)
E/flutter (16028): #2 MethodChannelImagePicker.pickImagePath (package:image_picker_platform_interface/src/method_channel/method_channel_image_picker.dart:62:21)
E/flutter (16028): #3 MethodChannelImagePicker.pickImage (package:image_picker_platform_interface/src/method_channel/method_channel_image_picker.dart:30:25)
E/flutter (16028): #4 ImagePicker.getImage (package:image_picker/image_picker.dart:101:21)
STEP 1 : Ensure you have imported the plugin by including this in your pubspec.yaml file
image_picker: ^0.6.7+4
STEP 2 : Make sure you have imported the plugin in the file you need it
import 'package:image_picker/image_picker.dart';
STEP 3 : Make sure you run this command
flutter pub get
Now, many times in Flutter even after doing the above 3 steps perfectly you will get the same error.
Here is my solution that has worked for me.
STEP 1 : Run this command in the terminal
flutter clean
STEP 2 : CLOSE/STOP your emulator and start it again
99% of the time this works for me.
just click stop red icon right side of run icon. and restart app

MissingPluginException while using plugin for flutter

I am trying to use the plugin
_launchURL(url) async {
await launch("www.google.com");
}
I have put "www.google.com" just for debugging purposes.
The error I get is MissingPluginException :
E/flutter ( 8299): MissingPluginException(No implementation found for method launch on channel plugins.flutter.io/url_launcher)
E/flutter ( 8299): #0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:278:7)
E/flutter ( 8299): <asynchronous suspension>
E/flutter ( 8299): #1 launch (package:url_launcher/url_launcher.dart:47:19)
E/flutter ( 8299): #2 _launchURL (file:///Users/matejsimunic/Work/dart/suhail/lib/main.dart:834:9)
E/flutter ( 8299): <asynchronous suspension>
E/flutter ( 8299): #3 _TripDetailBodyState.build.<anonymous closure> (file:///Users/matejsimunic/Work/dart/suhail/lib/main.dart:818:19)
E/flutter ( 8299): #4 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:494:14)
E/flutter ( 8299): #5 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:549:30)
E/flutter ( 8299): #6 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
E/flutter ( 8299): #7 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:161:9)
E/flutter ( 8299): #8 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:94:7)
E/flutter ( 8299): #9 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:315:9)
E/flutter ( 8299): #10 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12)
E/flutter ( 8299): #11 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:11)
E/flutter ( 8299): #12 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:143:19)
E/flutter ( 8299): #13 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:121:22)
E/flutter ( 8299): #14 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:101:7)
E/flutter ( 8299): #15 _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:64:7)
E/flutter ( 8299): #16 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:48:7)
E/flutter ( 8299): #17 _invoke1 (dart:ui/hooks.dart:134:13)
E/flutter ( 8299): #18 _dispatchPointerDataPacket (dart:ui/hooks.dart:91:5)
restarting the app from ide doesn't work.
If you are using hot restart or hot reload, it won't do the trick.
Since Flutter has to inject plugin dependencies into the platform-specific parts of your app, hot restart/hot reload is not enough to trigger the injection.
Check this issue for more.
Close the app and execute flutter run command.
flutter clean
Inside the console did the job as stated here
I faced this Error when using Url_launcher package. just had to stop and run the app, issue got solved
Simply Run these commands..
either--
Flutter clean
or
Invalidate Caches/Restart
Had problem while using flutter toast dependency and dependencies like facebook_login. I followed these steps and resolved it:
First, u need to test whether these toast and shared preference dependencies are causing problems or some other dependencies cause the problem.
For testing that, u need to create a new seprate flutter project having the same flutter toast and shared preference dependency and check now if u r able to get toasts or not.
If u r getting toast so there is no problem with ur toast dependency.
The problem might be in ur one of the social media dependency.
In my case, I followed the above steps and found that problem was in facebook dependency. Finally, I found that I did not provide details of my app at facebook developer console. So implemented that and my app was fine.
In my case it was for the cached_network_image plugin , I have removed cached_network_image from pubspec.yaml and replaced the implementation with Image.network and the problem has disappeared
In my case, I had this problem with the image picker, then I followed the documentation and used an emulator with api 29+, it didn't work before because I was using an emulator with api 28 https://pub.dev/packages/image_picker
Uninstalling and installing the app works for me
just open terminal and
step1 flutter clean
step2 flutter pub get
step3 flutter run
Its worked for me,
Thanks have a good day .
i think if you have already done flutter pub get on the dependency, and added all the requirements for the given platform you just have to flutter run your app