MissingPluginException(No implementation found for method DocumentReference) on Send data to firestore from flutter isolate

Issue

I’m trying to make a background location tracking application in Flutter. So I create an isolate for running background service. its working well if I store location data in local file system from isolate. but when I connect Firebase for sending data from isolate it gives the following error:


E/flutter (10142): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method DocumentReference#setData on channel plugins.flutter.io/cloud_firestore)
E/flutter (10142): #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
E/flutter (10142): <asynchronous suspension>
E/flutter (10142): #1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:329:12)
E/flutter (10142): #2      MethodChannelDocumentReference.setData (package:cloud_firestore_platform_interface/src/method_channel/method_channel_document_reference.dart:28:43)
E/flutter (10142): #3      DocumentReference.setData (package:cloud_firestore/src/document_reference.dart:48:22)
E/flutter (10142): #4      LocationServiceRepository.callback (package:alertcat/backLocation/location_service_repository.dart:61:15)
E/flutter (10142): #5      LocationCallbackHandler.callback (package:alertcat/backLocation/location_callback_handler.dart:23:40)
E/flutter (10142): #6      callbackDispatcher.<anonymous closure> (package:background_locator/callback_dispatcher.dart:22:15)
E/flutter (10142): #7      MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:409:55)
E/flutter (10142): #8      MethodChannel.setMethodCallHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:377:54)
E/flutter (10142): #9      _DefaultBinaryMessenger.handlePlatformMessage (package:flutter/src/services/binding.dart:199:33)
E/flutter (10142): #10     _invoke3.<anonymous closure> (dart:ui/hooks.dart:290:15)
E/flutter (10142): #11     _rootRun (dart:async/zone.dart:1184:13)
E/flutter (10142): #12     _CustomZone.run (dart:async/zone.dart:1077:19)
E/flutter (10142): #13     _CustomZone.runGuarded (dart:async/zone.dart:979:7)
E/flutter (10142): #14     _invoke3 (dart:ui/hooks.dart:289:10)
E/flutter (10142): #15     _dispatchPlatformMessage (dart:ui/hooks.dart:164:5)

But Firebase functioning properly from outside of the isolate. What can I do to resolve this?

Solution

The main problem was an internal dependency, there was another third party package that is somehow in conflict with the firestore package,

to solve this issue, I wrote native code for the other package, now it works fine

Answered By – Md Ariful Islam

Answer Checked By – Robin (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *