I just want to add audio_service https://pub.dartlang.org/packages/audio_service#-readme-tab- to my App.
For play audio. But didn't get success.
Basically, I'm iOS developer so don't know much about android setup.
Where I have to create, MainApplication and If I try to change AndroidManifest.xml It give error message because android:name=".MainApplication". How it possible to change android:name. Flutter won't allow.
Please help me for android setup.
EDITED:
odChannel#ryanheise.com/audioService( 8223): Failed to handle method call
E/MethodChannel#ryanheise.com/audioService( 8223): java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v4.media.session.MediaControllerCompat.addQueueItem(android.support.v4.media.MediaDescriptionCompat, int)' on a null object reference
E/MethodChannel#ryanheise.com/audioService( 8223): at com.ryanheise.audioservice.AudioServicePlugin$ClientHandler.onMethodCall(AudioServicePlugin.java:392)
E/MethodChannel#ryanheise.com/audioService( 8223): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:201)
E/MethodChannel#ryanheise.com/audioService( 8223): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:88)
E/MethodChannel#ryanheise.com/audioService( 8223): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:202)
E/MethodChannel#ryanheise.com/audioService( 8223): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#ryanheise.com/audioService( 8223): at android.os.MessageQueue.next(MessageQueue.java:329)
E/MethodChannel#ryanheise.com/audioService( 8223): at android.os.Looper.loop(Looper.java:142)
E/MethodChannel#ryanheise.com/audioService( 8223): at android.app.ActivityThread.main(ActivityThread.java:6375)
E/MethodChannel#ryanheise.com/audioService( 8223): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#ryanheise.com/audioService( 8223): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
E/MethodChannel#ryanheise.com/audioService( 8223): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)
E/flutter ( 8223): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: PlatformException(error, Attempt to invoke virtual method 'void android.support.v4.media.session.MediaControllerCompat.addQueueItem(android.support.v4.media.MediaDescriptionCompat, int)' on a null object reference, null)
E/flutter ( 8223): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:564:7)
E/flutter ( 8223): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:302:33)
E/flutter ( 8223): <asynchronous suspension>
E/flutter ( 8223): #2 AudioService.addQueueItemAt (package:audio_service/audio_service.dart:481:10)
E/flutter ( 8223): <asynchronous suspension>
E/flutter ( 8223): #3 _MyAppState.initializeAndroidPlayer (package:audio_player_service_example/main.dart:159:18)
E/flutter ( 8223): <asynchronous suspension>
E/flutter ( 8223): #4 _MyAppState.initState (package:audio_player_service_example/main.dart:124:5)
E/flutter ( 8223): #5 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3851:58)
E/flutter ( 8223): #6 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3716:5)
E/flutter ( 8223): #7 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2960:14)
E/flutter ( 8223): #8 Element.updateChild (package:flutter/src/widgets/framework.dart:2763:12)
E/flutter ( 8223): #9 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4881:14)
E/flutter ( 8223): #10 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2960:14)
E/flutter ( 8223): #11 Element.updateChild (package:flutter/src/widgets/framework.dart:2763:12)
E/flutter ( 8223): #12 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3752:16)
E/flutter ( 8223): #13 Element.rebuild (package:flutter/src/widgets/framework.dart:3564:5)
E/flutter ( 8223): #14 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3721:5)
E/flutter ( 8223): #15 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3716:5)
E/flutter ( 8223): #16 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2960:14)
E/flutter ( 8223): #17 Element.updateChild (package:flutter/src/widgets/framework.dart:2763:12)
E/flutter ( 8223): #18 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4881:14)
E/flutter ( 8223): #19 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2960:14)
E/flutter ( 8223): #20 Element.updateChild (package:flutter/src/widgets/framework.dart:2763:12)
E/flutter ( 8223): #21 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4881:14)
E/flutter ( 8223): #22 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2960:14)
E/flutter ( 8223): #23 Element.updateChild (package:flutter/src/widgets/framework.dart:2763:12)
E/flutter ( 8223): #24 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4881:14)
E/flutter ( 8223): #25 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2960:14)
E/flutter ( 8223): #26 Element.updateChild (package:flutter/src/widgets/framework.dart:2763:12)
E/flutter ( 8223): #27 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4881:14)
E/flutter ( 8223): #28 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2960:14)
E/flutter ( 8223): #29 Element.updateChild (package:flutter/src/widgets/framework.dart:2763:12)
E/flutter ( 8223): #30 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3752:16)
E/flutter ( 8223): #31 Element.rebuild (package:flutter/src/widgets/framework.dart:3564:5)
E/flutter ( 8223): #32 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3721:5)
E/flutter ( 8223): #33 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3869:11)
E/flutter ( 8223): #34 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3716:5)
E/flutter ( 8223): #35 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2960:14)
E/flutter ( 8223): #36 Element.updateChild (package:flutter/src/widgets/framework.dart:2763:12)
E/flutter ( 8223): #37 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3752:16)
E/flutter ( 8223): #38 Element.rebuild (package:flutter/src/widgets/framework.dart:3564:5)
E/flutter ( 8223): #39 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3721:5)
E/flutter ( 8223): #40 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3716:5)
E/flutter ( 8223): #41 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2960:14)
E/flutter ( 8223): #42 Element.updateChild (package:flutter/src/widgets/f
E/flutter ( 8223): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: MissingPluginException(No implementation found for method initPlayerQueue on channel audio_player_service)
E/flutter ( 8223): #0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:300:7)
E/flutter ( 8223): <asynchronous suspension>
E/flutter ( 8223): #1 AudioPlayer.initPlayerQueue (package:audio_player_service/audio_player.dart:250:19)
E/flutter ( 8223): <asynchronous suspension>
E/flutter ( 8223): #2 _MyAppState.initPlayer (package:audio_player_service_example/main.dart:148:23)
E/flutter ( 8223): <asynchronous suspension>
E/flutter ( 8223): #3 _MyAppState.initState (package:audio_player_service_example/main.dart:126:5)
E/flutter ( 8223): #4 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3851:58)
E/flutter ( 8223): #5 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3716:5)
E/flutter ( 8223): #6 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2960:14)
E/flutter ( 8223): #7 Element.updateChild (package:flutter/src/widgets/framework.dart:2763:12)
E/flutter ( 8223): #8 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4881:14)
E/flutter ( 8223): #9 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2960:14)
E/flutter ( 8223): #10 Element.updateChild (package:flutter/src/widgets/framework.dart:2763:12)
E/flutter ( 8223): #11 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3752:16)
E/flutter ( 8223): #12 Element.rebuild (package:flutter/src/widgets/framework.dart:3564:5)
E/flutter ( 8223): #13 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3721:5)
E/flutter ( 8223): #14 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3716:5)
E/flutter ( 8223): #15 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2960:14)
E/flutter ( 8223): #16 Element.updateChild (package:flutter/src/widgets/framework.dart:2763:12)
E/flutter ( 8223): #17 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4881:14)
E/flutter ( 8223): #18 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2960:14)
E/flutter ( 8223): #19 Element.updateChild (package:flutter/src/widgets/framework.dart:2763:12)
E/flutter ( 8223): #20 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4881:14)
E/flutter ( 8223): #21 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2960:14)
E/flutter ( 8223): #22 Element.updateChild (package:flutter/src/widgets/framework.dart:2763:12)
E/flutter ( 8223): #23 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4881:14)
E/flutter ( 8223): #24 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2960:14)
E/flutter ( 8223): #25 Element.updateChild (package:flutter/src/widgets/framework.dart:2763:12)
E/flutter ( 8223): #26 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4881:14)
E/flutter ( 8223): #27 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2960:14)
E/flutter ( 8223): #28 Element.updateChild (package:flutter/src/widgets/framework.dart:2763:12)
E/flutter ( 8223): #29 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3752:16)
E/flutter ( 8223): #30 Element.rebuild (package:flutter/src/widgets/framework.dart:3564:5)
E/flutter ( 8223): #31 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3721:5)
E/flutter ( 8223): #32 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3869:11)
E/flutter ( 8223): #33 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3716:5)
E/flutter ( 8223): #34 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2960:14)
E/flutter ( 8223): #35 Element.updateChild (package:flutter/src/widgets/framework.dart:2763:12)
E/flutter ( 8223): #36 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3752:16)
E/flutter ( 8223): #37 Element.rebuild (package:flutter/src/widgets/framework.dart:3564:5)
E/flutter ( 8223): #38 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3721:5)
E/flutter ( 8223): #39 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3716:5)
E/flutter ( 8223): #40 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2960:14)
E/flutter ( 8223): #41 Element.updateChild (package:flutter/src/widgets/framework.dart:2763:12)
E/flutter ( 8223): #42 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3752:16)
E/flutter ( 8223): #43 Element.rebuild (package:flutter/src/widgets/framework.dart:3564:5)
E/flutter ( 8223): #44 ComponentElement._firs
You can create MainApplication class in Android studio. Take a look at these screenshots.
Just add this right before the </application> in the AndroidManifest.xml file.
<service android:name="com.ryanheise.audioservice.AudioService">
<intent-filter>
<action android:name="android.media.browse.MediaBrowserService" />
</intent-filter>
</service>
<receiver android:name="android.support.v4.media.session.MediaButtonReceiver" >
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</receiver>
I am attempting the same thing, and when I add the service and receiver tags to AndroidManifest.xml, I am getting an error, which might be the same problem you are having:
Class referenced in the manifest, com.ryanheise.audioservice.AudioService, was not found in the project or the libraries / Unresolved package 'audioservice'
And yes, I have audio_service as a dependency in my pubspec.yaml, and yes I did Pub Get.
I don't know why this error is happening, but I can't imagine that audio_service could run without this.
Related
Good afternoon,
I am following the tutorial on Windows 7 for an Ipad on IOS 9.3.5 :
https://medium.com/flutter-community/developing-and-debugging-flutter-apps-for-ios-without-a-mac-8d362a8ec667
and I'm stuck at rebuilding the Flutter Tool. (Last part of the tutorial)
I downloaded (from the link of the tutorial) and copied in C:\src\flutter\bin the libimobiledevice, ideviceinstaller and which binaries.
Then I ran the git apply ios.diff which gives me multiple errors, sometimes it's just about mac.dart, and sometimes it's more like this :
error: patch failed: packages/flutter_tools/lib/src/ios/devices.dart:103
error: packages/flutter_tools/lib/src/ios/devices.dart: patch does not apply
error: patch failed: packages/flutter_tools/lib/src/ios/ios_workflow.dart:26
error: packages/flutter_tools/lib/src/ios/ios_workflow.dart: patch does not apply
error: patch failed: packages/flutter_tools/lib/src/ios/mac.dart:124
error: packages/flutter_tools/lib/src/ios/mac.dart: patch does not apply
Then I found this command in here : git: patch does not apply
git apply --reject --whitespace=fix mychanges.patch
What I got was : (don't mind the content of the Future<String>, it's because I've already changed it to what it was supposed to be)
Checking patch packages/flutter_tools/lib/src/ios/mac.dart...
error: while searching for:
Future<String> getAvailableDeviceIDs() async {
try {
final ProcessResult result = await processManager.run(<String>['idevice_id', '-l']);
if (result.exitCode != 0)
throw ToolExit('idevice_id returned an error:\n${result.stderr}');
return result.stdout;
} on ProcessException {
throw ToolExit('Failed to invoke idevice_id. Run flutter doctor.');
error: patch failed: packages/flutter_tools/lib/src/ios/mac.dart:124
Applying patch packages/flutter_tools/lib/src/ios/devices.dart with 1 reject...
Rejected hunk #1.
Applying patch packages/flutter_tools/lib/src/ios/ios_workflow.dart with 1 reject...
Rejected hunk #1.
Applying patch packages/flutter_tools/lib/src/ios/mac.dart with 1 reject...
Rejected hunk #1.
At this point I manually pasted the right content in the mac.dart file (as you might have seen in the error above), but I am still not sure everything went well because of the :
error: patch failed: packages/flutter_tools/lib/src/ios/mac.dart:124
Anyway, I kept going and ran the command to rebuild the flutter tool:
bin\cache\dart-sdk\bin\dart --snapshot=.\bin\cache\flutter_tools.snapshot --packages=.\packages\flutter_tools\.packages .\packages\flutter_tools\bin\flutter_tools.dart
Finally, the output is this :
C:\src\flutter>bin\cache\dart-sdk\bin\dart --snapshot=.\bin\cache\flutter_tools.snapshot --packages=.\packages\flutter_tools\.packages .\
packages\flutter_tools\bin\flutter_tools.dart
packages/flutter_tools/lib/src/ios/ios_workflow.dart:20:30: Error: Getter not found: 'iMobileDevice'.
bool get canListDevices => iMobileDevice.isInstalled || (xcode.isInstalledAndMeetsVersionCheck && xcode.isSimctlInstalled);
^^^^^^^^^^^^^
packages/flutter_tools/lib/src/ios/ios_workflow.dart:20:30: Error: The getter 'iMobileDevice' isn't defined for the class 'IOSWorkflow'.
- 'IOSWorkflow' is from 'package:flutter_tools/src/ios/ios_workflow.dart' ('packages/flutter_tools/lib/src/ios/ios_workflow.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'iMobileDevice'.
bool get canListDevices => iMobileDevice.isInstalled || (xcode.isInstalledAndMeetsVersionCheck && xcode.isSimctlInstalled);
^^^^^^^^^^^^^
Is this "iMobileDevice" related to this libimobiledevice ? I can run any of the ideviceinstaller.exe or idevice_id.exe, so I guess I installed it correctly.
I am missing something important to correct this error ?
Thanks a lot for your time :)
in the "ios_workflow.dart" file you have to write this where the other 'import...' rows are:
import 'mac.dart';
For me, it's solved the problem.
Thanks a lot ! Importing 'mac.dart' allowed me to apply everything correctly.
I then ran flutter attach, and here is what I get : (I guess only the first lines are useful)
D:\Beerproject>flutter attach
Sending crash report to Google.
Crash report sent (report ID: 5d71ca5958062efd)
Oops; flutter has exited unexpectedly.
Sending crash report to Google.
Crash report sent (report ID: 5024a42feb468e2b)
Oops; flutter has exited unexpectedly.
Unhandled exception:
Unsupported operation: Control of iOS devices or simulators only supported on Mac OS.
#0 IOSDevice.getAttachedDevices (package:flutter_tools/src/ios/devices.dart:172:7)
<asynchronous suspension>
#1 IOSDevices.pollingGetDevices (package:flutter_tools/src/ios/devices.dart:117:57)
#2 PollingDeviceDiscovery.devices (package:flutter_tools/src/device.dart:270:52)
<asynchronous suspension>
#3 DeviceManager.getAllConnectedDevices (package:flutter_tools/src/device.dart:136:46)
<asynchronous suspension>
#4 DeviceValidator.validate (package:flutter_tools/src/doctor.dart:760:54)
<asynchronous suspension>
#5 Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:140:52)
#6 Doctor.diagnose (package:flutter_tools/src/doctor.dart:211:41)
#7 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:43:6)
#8 Doctor.diagnose (package:flutter_tools/src/doctor.dart:201:24)
#9 _doctorText.<anonymous closure> (package:flutter_tools/runner.dart:202:26)
#10 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:154:29)
#11 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:43:6)
#12 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:154:7)
#13 _rootRun (dart:async/zone.dart:1124:13)
#14 _CustomZone.run (dart:async/zone.dart:1021:19)
#15 _runZoned (dart:async/zone.dart:1516:10)
#16 runZoned (dart:async/zone.dart:1463:12)
#17 AppContext.run (package:flutter_tools/src/base/context.dart:153:18)
#18 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:43:6)
#19 AppContext.run (package:flutter_tools/src/base/context.dart:140:19)
#20 _doctorText (package:flutter_tools/runner.dart:201:19)
#21 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:43:6)
#22 _doctorText (package:flutter_tools/runner.dart:197:27)
#23 _createLocalCrashReport (package:flutter_tools/runner.dart:179:32)
#24 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:43:6)
#25 _createLocalCrashReport (package:flutter_tools/runner.dart:164:37)
#26 _handleToolError (package:flutter_tools/runner.dart:134:33)
#27 _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#28 _rootRunUnary (dart:async/zone.dart:1132:38)
#29 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#30 _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#31 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#32 Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#33 Future._completeWithValue (dart:async/future_impl.dart:522:5)
#34 _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:30:15)
#35 _completeOnAsyncReturn (dart:async-patch/async_patch.dart:288:13)
#36 CrashReportSender.sendReport (package:flutter_tools/src/reporting/crash_reporting.dart)
#37 _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#38 _rootRunUnary (dart:async/zone.dart:1132:38)
#39 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#40 _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#41 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#42 Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#43 Future._complete (dart:async/future_impl.dart:512:7)
#44 Stream.fold.<anonymous closure> (dart:async/stream.dart:801:18)
#45 _rootRun (dart:async/zone.dart:1120:38)
#46 _CustomZone.run (dart:async/zone.dart:1021:19)
#47 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#48 _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#49 _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#50 _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#51 _SinkTransformerStreamSubscription._close (dart:async/stream_transformers.dart:96:11)
#52 _EventSinkWrapper.close (dart:async/stream_transformers.dart:23:11)
#53 _StringAdapterSink.close (dart:convert/string_conversion.dart:249:11)
#54 _Utf8ConversionSink.close (dart:convert/string_conversion.dart:300:20)
#55 _ConverterStreamEventSink.close (dart:convert/chunked_conversion.dart:80:18)
#56 _SinkTransformerStreamSubscription._handleDone (dart:async/stream_transformers.dart:141:24)
#57 _rootRun (dart:async/zone.dart:1120:38)
#58 _CustomZone.run (dart:async/zone.dart:1021:19)
#59 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#60 _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#61 _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#62 _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#63 _ForwardingStream._handleDone (dart:async/stream_pipe.dart:106:10)
#64 _ForwardingStreamSubscription._handleDone (dart:async/stream_pipe.dart:172:13)
#65 _rootRun (dart:async/zone.dart:1120:38)
#66 _CustomZone.run (dart:async/zone.dart:1021:19)
#67 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#68 _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#69 _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#70 _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#71 _SinkTransformerStreamSubscription._close (dart:async/stream_transformers.dart:96:11)
#72 _EventSinkWrapper.close (dart:async/stream_transformers.dart:23:11)
#73 _Uint8ListConversionSink.close (dart:_http/http_impl.dart:577:13)
#74 _ConverterStreamEventSink.close (dart:convert/chunked_conversion.dart:80:18)
#75 _SinkTransformerStreamSubscription._handleDone (dart:async/stream_transformers.dart:141:24)
#76 _rootRun (dart:async/zone.dart:1120:38)
#77 _CustomZone.run (dart:async/zone.dart:1021:19)
#78 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#79 _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#80 _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#81 _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#82 _SinkTransformerStreamSubscription._close (dart:async/stream_transformers.dart:96:11)
#83 _EventSinkWrapper.close (dart:async/stream_transformers.dart:23:11)
#84 _ByteAdapterSink.close (dart:convert/byte_conversion.dart:62:11)
#85 _FilterSink.close (dart:io/data_transformer.dart:637:11)
#86 _ConverterStreamEventSink.close (dart:convert/chunked_conversion.dart:80:18)
#87 _SinkTransformerStreamSubscription._handleDone (dart:async/stream_transformers.dart:141:24)
#88 _rootRun (dart:async/zone.dart:1120:38)
#89 _CustomZone.run (dart:async/zone.dart:1021:19)
#90 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#91 _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#92 _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#93 _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#94 _ForwardingStream._handleDone (dart:async/stream_pipe.dart:106:10)
#95 _ForwardingStreamSubscription._handleDone (dart:async/stream_pipe.dart:172:13)
#96 _rootRun (dart:async/zone.dart:1120:38)
#97 _CustomZone.run (dart:async/zone.dart:1021:19)
#98 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#99 _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart:389:13)
#100 _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:399:15)
#101 _BufferingStreamSubscription._close (dart:async/stream_impl.dart:283:7)
#102 _SyncStreamControllerDispatch._sendDone (dart:async/stream_controller.dart:772:19)
#103 _StreamController._closeUnchecked (dart:async/stream_controller.dart:629:7)
#104 _StreamController.close (dart:async/stream_controller.dart:622:5)
#105 _HttpParser._closeIncoming (dart:_http/http_parser.dart:1037:23)
#106 _HttpParser._doParse (dart:_http/http_parser.dart:752:11)
#107 _HttpParser._parse (dart:_http/http_parser.dart:318:7)
#108 _HttpParser._onData (dart:_http/http_parser.dart:810:5)
#109 _rootRunUnary (dart:async/zone.dart:1132:38)
#110 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#111 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#112 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#113 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#114 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:764:19)
#115 _StreamController._add (dart:async/stream_controller.dart:640:7)
#116 _StreamController.add (dart:async/stream_controller.dart:586:5)
#117 _Socket._onData (dart:io-patch/socket_patch.dart:1791:41)
#118 _rootRunUnary (dart:async/zone.dart:1132:38)
#119 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#120 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#121 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#122 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#123 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:764:19)
#124 _StreamController._add (dart:async/stream_controller.dart:640:7)
#125 _StreamController.add (dart:async/stream_controller.dart:586:5)
#126 _RawSecureSocket._sendReadEvent (dart:io/secure_socket.dart:1004:19)
#127 _rootRun (dart:async/zone.dart:1120:38)
#128 _CustomZone.run (dart:async/zone.dart:1021:19)
#129 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#130 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#131 _rootRun (dart:async/zone.dart:1124:13)
#132 _CustomZone.run (dart:async/zone.dart:1021:19)
#133 _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#134 Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:21:15)
#135 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:382:19)
#136 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:416:5)
#137 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
Did anyone ever got this error ?
EDIT : following this tutorial step by step didn't solve the problem ... (https://www.youtube.com/watch?v=jkWPQHLOAEw)
SOLVED : I finally ended up using the Mac of a friend. Maybe could work using a virtual machine as well.
I'm running my application in debug mode, and when i try to hotrestart or hotreload this error shows and the application finishes, this happened after I did flutter upgrade. I don't know where this error is my code, my application worked normally in release mode
NoSuchMethodError: The method 'isAfter' was called on null.
Receiver: null
Tried calling: isAfter(Instance of 'DateTime')
#0 Object.noSuchMethod (dart:core/runtime/lib/object_patch.dart:50:5)
#1 _ManifestAssetBundle.needsBuild (package:flutter_tools/src/asset.dart:91:41)
#2 HotRunner._updateDevFS (package:flutter_tools/src/run_hot.dart:311:44)
<asynchronous suspension>
#3 HotRunner._reloadSources (package:flutter_tools/src/run_hot.dart:622:47)
<asynchronous suspension>
#4 HotRunner.restart (package:flutter_tools/src/run_hot.dart:566:24)
<asynchronous suspension>
#5 HotRunner.handleTerminalCommand (package:flutter_tools/src/run_hot.dart:281:24)
<asynchronous suspension>
#6 ResidentRunner.processTerminalInput (package:flutter_tools/src/resident_runner.dart:890:15)
<asynchronous suspension>
#7 _rootRunUnary (dart:async/zone.dart:1132:38)
#8 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#9 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#10 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#11 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#12 _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:375:20)
#13 _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:250:5)
#14 _AsBroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:474:11)
#15 _rootRunUnary (dart:async/zone.dart:1132:38)
#16 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#17 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#18 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#19 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#20 _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68:11)
#21 _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11)
#22 _StringAdapterSink.add (dart:convert/string_conversion.dart:236:11)
#23 _StringAdapterSink.addSlice (dart:convert/string_conversion.dart:241:7)
#24 _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:312:20)
#25 _ErrorHandlingAsciiDecoderSink.addSlice (dart:convert/ascii.dart:252:17)
#26 _ErrorHandlingAsciiDecoderSink.add (dart:convert/ascii.dart:238:5)
#27 _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:72:18)
#28 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24)
#29 _rootRunUnary (dart:async/zone.dart:1132:38)
#30 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#31 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#32 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#33 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#34 _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19)
#35 _StreamController._add (dart:async/stream_controller.dart:640:7)
#36 _StreamController.add (dart:async/stream_controller.dart:586:5)
#37 _Socket._onData (dart:io/runtime/bin/socket_patch.dart:1774:41)
#38 _rootRunUnary (dart:async/zone.dart:1136:13)
#39 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#40 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#41 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
#42 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
#43 _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19)
#44 _StreamController._add (dart:async/stream_controller.dart:640:7)
#45 _StreamController.add (dart:async/stream_controller.dart:586:5)
#46 new _RawSocket.<anonymous closure> (dart:io/runtime/bin/socket_patch.dart:1323:33)
#47 _NativeSocket.issueReadEvent.issue (dart:io/runtime/bin/socket_patch.dart:844:14)
#48 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#49 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#50 _runPendingImmediateCallback (dart:isolate/runtime/lib/isolate_patch.dart:115:13)
#51 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/lib/isolate_patch.dart:172:5)
i am trying to pass data from my flutter app to other apps. The purpose is to send the download link for my app to another app(say watsapp,facebook,twitter etc.).
I am using flutter plugin share 0.6.0+1. i added the package as instructed. But when i ran the program, the following error was displayed:
[ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: MissingPluginException(No implementation found for method share on channel plugins.flutter.io/share)
E/flutter ( 8153): #0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:300:7)
E/flutter ( 8153): <asynchronous suspension>
E/flutter ( 8153): #1 Share.share (package:share/share.dart:44:20)
E/flutter ( 8153): #2 _MyHomePageState.build.<anonymous closure> (package:unit_converter/main.dart:409:34)
E/flutter ( 8153): #3 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:513:14)
E/flutter ( 8153): #4 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:568:30)
E/flutter ( 8153): #5 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:120:24)
E/flutter ( 8153): #6 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:242:9)
E/flutter ( 8153): #7 TapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:204:7)
E/flutter ( 8153): #8 GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:156:27)
E/flutter ( 8153): #9 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:218:20)
E/flutter ( 8153): #10 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:192:22)
E/flutter ( 8153): #11 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:149:7)
E/flutter ( 8153): #12 _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:101:7)
E/flutter ( 8153): #13 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:85:7)
E/flutter ( 8153): #14 _rootRunUnary (dart:async/zone.dart:1136:13)
E/flutter ( 8153): #15 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
E/flutter ( 8153): #16 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
E/flutter ( 8153): #17 _invoke1 (dart:ui/hooks.dart:223:10)
E/flutter ( 8153): #18 _dispatchPointerDataPacket (dart:ui/hooks.dart:144:5)
The following is the content of my pubspec.yaml file:
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
dart2_constant: ^1.0.2+dart2
math_expressions: ^1.0.0
shared_preferences: ^0.4.3
#loader_search_bar: ^1.0.3+1
material_search: ^0.2.8
path_provider: '>=0.3.0'
sqflite: any
flutter_colorpicker: ^0.2.1
intl: ^0.15.7
auto_size_text: ^0.3.0
cloud_firestore: ^0.9.0
animated_text_kit: ^1.3.0
share: ^0.6.0+1
The following is my implementation:
Share.share('Hi, take a time to click and download this app: market://search?q=pname:com.myappbase.appname');
Please can anyone point me to what i am doing wrong. i seem to have tried ieverything but these same errors have been coming up.Or is there a more elegant way this can be done? Thanks
You must terminate the app and rerun it from scratch as share dependency required platform channel methods to be called. the app has to terminate and rerun from scratch.
My "hello world" flutter app yields a compile time exception when I run it and I don't know why, could you help?
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
Gradle task 'assembleDebug'...
Built build\app\outputs\apk\debug\app-debug.apk.
Installing build\app\outputs\apk\app.apk...
I/Choreographer(11667): Skipped 38 frames! The application may be doing too much work on its main thread.
D/EGL_emulation(11667): eglMakeCurrent: 0x9fe05840: ver 3 0 (tinfo 0x9fe038e0)
Syncing files to device Android SDK built for x86...
I/flutter (11667): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (11667): The following _CompileTimeError was thrown building WidgetsApp-[GlobalObjectKey
I/flutter (11667): _MaterialAppState#bcca2](dirty, state: _WidgetsAppState#2be90):
I/flutter (11667): 'package:flutter/src/widgets/app.dart': error: line 1129 pos 21:
I/flutter (11667): file:///D:/Flutter/flutter/packages/flutter/lib/src/widgets/app.dart:1129:21: Error: Too few
I/flutter (11667): positional arguments: 1 required, 0 given.
I/flutter (11667): result = Stack(
I/flutter (11667): ^
I/flutter (11667): result = Stack(
I/flutter (11667): ^
I/flutter (11667):
I/flutter (11667): When the exception was thrown, this was the stack:
I/flutter (11667): #0 StatefulElement.build (package:flutter/src/widgets/framework.dart:3809:27)
I/flutter (11667): #1 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3721:15)
I/flutter (11667): #2 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
I/flutter (11667): #3 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
I/flutter (11667): #4 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3848:11)
I/flutter (11667): #5 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
I/flutter (11667): #6 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
I/flutter (11667): #7 Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
I/flutter (11667): #8 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
I/flutter (11667): #9 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
I/flutter (11667): #10 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
I/flutter (11667): #11 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
I/flutter (11667): #12 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
I/flutter (11667): #13 Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
I/flutter (11667): #14 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
I/flutter (11667): #15 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
I/flutter (11667): #16 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
I/flutter (11667): #17 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
I/flutter (11667): #18 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
I/flutter (11667): #19 Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
I/flutter (11667): #20 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
I/flutter (11667): #21 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
I/flutter (11667): #22 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
I/flutter (11667): #23 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
I/flutter (11667): #24 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
I/flutter (11667): #25 Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
I/flutter (11667): #26 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
I/flutter (11667): #27 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
I/flutter (11667): #28 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
I/flutter (11667): #29 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3848:11)
I/flutter (11667): #30 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
I/flutter (11667): #31 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
I/flutter (11667): #32 Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
I/flutter (11667): #33 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
I/flutter (11667): #34 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
I/flutter (11667): #35 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
I/flutter (11667): #36 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
I/flutter (11667): #37 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
I/flutter (11667): #38 Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
I/flutter (11667): #39 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
I/flutter (11667): #40 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
I/flutter (11667): #41 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
I/flutter (11667): #42 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3848:11)
I/flutter (11667): #43 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
I/flutter (11667): #44 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
I/flutter (11667): #45 Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
I/flutter (11667): #46 RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:909:16)
I/flutter (11667): #47 RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:880:5)
I/flutter (11667): #48 RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure> (package:flutter/src/widgets/binding.dart:826:17)
I/flutter (11667): #49 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2266:19)
I/flutter (11667): #50 RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:825:13)
I/flutter (11667): #51 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:712:7)
I/flutter (11667): #52 runApp (package:flutter/src/widgets/binding.dart:756:7)
I/flutter (11667): #53 main (package:new_flutter_app_demo/main.dart:4:3)
I/flutter (11667): #54 _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:289:19)
I/flutter (11667): #55 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
I/flutter (11667): ════════════════════════════════════════════════════════════════════════════════════════════════════
D/ (11667): HostConnection::get() New Host Connection established 0x8bae6140, tid 11694
D/EGL_emulation(11667): eglMakeCurrent: 0xa7a652e0: ver 3 0 (tinfo 0x9fb09ac0)
Sorry for late answering.Please delete flutter sdk and reinstall flutter sdk it is complete work.
Executing the following commands in the Flutter install directory should fix it
git clean -xfd
git stash save --keep-index
git stash drop
git pull
flutter doctor
i want to use mongo to store my app data, but when ever i try to await db.open() this error appear on the console:
[ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter (11408): type 'Future<dynamic>' is not a subtype of type 'Future<bool>' where
E/flutter (11408): Future is from dart:async
E/flutter (11408): Future is from dart:async
E/flutter (11408): bool is from dart:core
E/flutter (11408):
E/flutter (11408): #0 _Connection.connect (file:///C:/Users/Picmix/flutter/.pub-cache/hosted/pub.dartlang.org/mongo_dart-0.3.1/lib/src/network/connection.dart:73:22)
E/flutter (11408): #1 _ConnectionManager._connect (file:///C:/Users/Picmix/flutter/.pub-cache/hosted/pub.dartlang.org/mongo_dart-0.3.1/lib/src/network/connection_manager.dart:23:22)
E/flutter (11408): <asynchronous suspension>
E/flutter (11408): #2 _ConnectionManager.open.<anonymous closure> (file:///C:/Users/Picmix/flutter/.pub-cache/hosted/pub.dartlang.org/mongo_dart-0.3.1/lib/src/network/connection_manager.dart:58:14)
E/flutter (11408): #3 Future.forEach.<anonymous closure> (dart:async/future.dart:484:26)
E/flutter (11408): #4 Future.doWhile.<anonymous closure> (dart:async/future.dart:526:26)
E/flutter (11408): #5 _RootZone.runUnaryGuarded (dart:async/zone.dart:1316:10)
E/flutter (11408): #6 _RootZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1355:26)
E/flutter (11408): #7 Future.doWhile (dart:async/future.dart:541:18)
E/flutter (11408): #8 Future.forEach (dart:async/future.dart:482:12)
E/flutter (11408): #9 _ConnectionManager.open (file:///C:/Users/Picmix/flutter/.pub-cache/hosted/pub.dartlang.org/mongo_dart-0.3.1/lib/src/network/connection_manager.dart:56:19)
E/flutter (11408): #10 Db.open.<anonymous closure> (file:///C:/Users/Picmix/flutter/.pub-cache/hosted/pub.dartlang.org/mongo_dart-0.3.1/lib/src/database/db.dart:252:33)
E/flutter (11408): #11 new Future.sync (dart:async/future.dart:222:31)
E/flutter (11408): #12 Db.open (file:///C:/Users/Picmix/flutter/.pub-cache/hosted/pub.dartlang.org/mongo_dart-0.3.1/lib/src/database/db.dart:239:16)
E/flutter (11408): #13 main (file:///F:/Jamil/WORKSHOP/MY-PRACTICE/FLUTTER/FLUTTERMONGO/simplecrud/lib/main.dart:6:6)
E/flutter (11408): <asynchronous suspension>
E/flutter (11408): #14 _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:279:19)
E/flutter (11408): #15 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:165:12)
E/flutter (11408): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter (11408): type '(MongoReplyMessage) => void' is not a subtype of type '(dynamic) => void'
E/flutter (11408): #0 _rootHandleUncaughtError.<anonymous closure> (dart:async/zone.dart:1114:29)
E/flutter (11408): #1 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter (11408): #2 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
and this is the simple code that i write to open connection between mlab and the app:
import 'package:mongo_dart/mongo_dart.dart';
void main() async {
print('hello');
Db db = new Db('mongodb://<myusername><mypassword>#ds147659.mlab.com:47659/simple-crud');
db.open().then((success) {
if (success) print('connected');
});
}
any idea sir?
This is due to the latest flutter update beta2.
Please check this blog by flutter
Seems like there is a flutter version mismatch of your project and Mongo plugin.
Mongo's latest plugin was updated on Oct 24, 2017.
There is already an issue on their git. You can keep track of it.
Meanwhile, according to this issue:
you can try changing the plugin code from
Future<bool> get isOn => _channel.invokeMethod('isOn');
to
Future<bool> get isOn async {
final bool isOn = await _channel.invokeMethod('isOn');
return isOn;
}
NOTE: Above is just an example, please check the plugin dart file for the correct function to change.