Repository navigation
[maps] MissingPluginException when calling methods on maps instance that has been torn down on the native side #43785
Copy link
Copy link
Closed
flutter/packages
#9242Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: crashStack traces logged to the consoleStack traces logged to the consolecustomer: crowdAffects or could affect many people, though not necessarily a specific customer.Affects or could affect many people, though not necessarily a specific customer.p: mapsGoogle Maps pluginGoogle Maps pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team
Description
Hello, I am experiencing this error below, whenever I use the google map.
Also, please find below the flutter doctor -v output as well.
E/BufferQueueProducer(12362): [SurfaceTexture-0-12362-4] queueBuffer: BufferQueue has been abandoned
E/BufferQueueProducer(12362): [SurfaceTexture-0-12362-4] dequeueBuffer: BufferQueue has been abandoned
E/flutter (12362): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: MissingPluginException(No implementation found for method map#update on channel plugins.flutter.io/google_maps_4)
E/flutter (12362): #0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:314:7)
E/flutter (12362): <asynchronous suspension>
E/flutter (12362): #1 GoogleMapController._updateMapOptions (package:google_maps_flutter/src/controller.dart:96:19)
E/flutter (12362): <asynchronous suspension>
E/flutter (12362): #2 _GoogleMapState._updateOptions (package:google_maps_flutter/src/google_map.dart:256:16)
E/flutter (12362): <asynchronous suspension>
E/flutter (12362): #3 _GoogleMapState.didUpdateWidget (package:google_maps_flutter/src/google_map.dart:241:5)
E/flutter (12362): #4 StatefulElement.update (package:flutter/src/widgets/framework.dart:4103:58)
E/flutter (12362): #5 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15)
E/flutter (12362): #6 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16)
E/flutter (12362): #7 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5)
E/flutter (12362): #8 ProxyElement.update (package:flutter/src/widgets/framework.dart:4254:5)
E/flutter (12362): #9 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15)
E/flutter (12362): #10 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16)
E/flutter (12362): #11 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5)
E/flutter (12362): #12 ProxyElement.update (package:flutter/src/widgets/framework.dart:4254:5)
E/flutter (12362): #13 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15)
E/flutter (12362): #14 RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:4852:32)
E/flutter (12362): #15 MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5243:17)
E/flutter (12362): #16 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15)
E/flutter (12362): #17 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16)
E/flutter (12362): #18 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5)
E/flutter (12362): #19 StatefulElement.update (package:flutter/src/widgets/framework.dart:4120:5)
E/flutter (12362): #20 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15)
E/flutter (12362): #21 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16)
E/flutter (12362): #22 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5)
E/flutter (12362): #23 ProxyElement.update (package:flutter/src/widgets/framework.dart:4254:5)
E/flutter (12362): #24 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15)
E/flutter (12362): #25 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16)
E/flutter (12362): #26 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5)
E/flutter (12362): #27 StatefulElement.update (package:flutter/src/widgets/framework.dart:4120:5)
E/flutter (12362): #28 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15)
E/flutter (12362): #29 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5134:14)
E/flutter (12362): #30 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15)
E/flutter (12362): #31 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16)
E/flutter (12362): #32 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5)
E/flutter (12362): #33 StatelessElement.update (package:flutter/src/widgets/framework.dart:4016:5)
E/flutter (12362): #34 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15)
E/flutter (12362): #35 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5134:14)
E/flutter (12362): #36 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15)
E/flutter (12362): #37 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16)
E/flutter (12362): #38 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5)
E/flutter (12362): #39 StatefulElement.update (package:flutter/src/widgets/framework.dart:4120:5)
E/flutter (12362): #40 Element.updateChild (package:flutter/src/widgets/framework.dart:2893:15)
E/flutter (12362): #41 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3961:16)
E/flutter (12362): #42 Element.rebuild (package:flutter/src/widgets/framework.dart:3738:5)
E/flutter (12362): #43 StatefulElement.update (package:flutter/src/widgets/framework.dart:4120:5)
E/flutter (12362): #44 Element.updateChild (package:
E/flutter (12362): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)]
[√] Flutter (Channel stable, v1.9.1+hotfix.2, on Microsoft Windows [versão 10.0.18362.418], locale pt-BR)
• Flutter version 1.9.1+hotfix.2 at c:\src\flutter
• Framework revision 2d2a1ffec9 (8 weeks ago), 2019-09-06 18:39:49 -0700
• Engine revision b863200c37
• Dart version 2.5.0
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\rafas\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: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.
[√] Android Studio (version 3.5)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 39.0.3
• Dart plugin version 191.8423
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[!] Connected device
! No devices available
! Doctor found issues in 1 category.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: crashStack traces logged to the consoleStack traces logged to the consolecustomer: crowdAffects or could affect many people, though not necessarily a specific customer.Affects or could affect many people, though not necessarily a specific customer.p: mapsGoogle Maps pluginGoogle Maps pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team
Activity
ThinkDigitalSoftware commentedon Oct 30, 2019
Have you tried stopping the app and rebuilding it after adding the dependency?
rafaelsimonassi commentedon Oct 30, 2019
BondarenkoStas commentedon Oct 30, 2019
@rafaelsimonassi I probably miss something, but I wonder, why is there
plugins.flutter.io/google_maps_4not justplugins.flutter.io/google_maps?Does it work normally when you don't add multiple markers?
rafaelsimonassi commentedon Oct 30, 2019
JBBx2016 commentedon Oct 30, 2019
I get this too whenever the build function that holds GoogleMap fails. It seems that it causes the map to be removed, and then recreated (with the red error printout). Is there any chance any errors are thrown during build?
KlausJokisuo commentedon Nov 20, 2019
To investigate the issue we would need a minimal runnable reproduction as a single file 👍
SalilLuley commentedon Dec 19, 2019
What to do in this case? I am getting this error
Unhandled Exception: MissingPluginException(No implementation found for method map#update on channel plugins.flutter.io/google_maps_1)
vimalmistry commentedon Jan 1, 2020
Same issue. Any solution found??
plugins.flutter.io/google_maps_0KlausJokisuo commentedon Jan 1, 2020
Can you provide us a minimal runnable reproduction as a single file?
klaszlo8207 commentedon Jan 6, 2020
Hmm, I got a lot of error reporting on this too, in my firebase crashlitycs. But the app not crashing...
my 133 row:
KlausJokisuo commentedon Jan 7, 2020
Can you provide us a minimal runnable reproduction as a single file?
93 remaining items
stuartmorgan-g commentedon May 5, 2025
I'm saying that there are two potential ways of getting this exception:
Any instances of 1 are a valid bug in the plugin, and should be fixed by silently dropping whatever the call is. Any instances of 2 are bugs in the client code.
Re-reading, it looks like you want to try to make the experience of 2 better, whereas I was thinking about actually fixing 1. For client code, if we want to make the error more explicit, 3 seems like the best option, except that it would be an
Errortype, not anExceptiontype, because it's a programming error. I'm not sure what you mean by "a lot of boilerplate around every method call"; could you elaborate on that part?filiph commentedon May 5, 2025
Thanks for the clarification.
Yes, I was referring to the second way to get the exception, since it's what most of the commenters on this thread seem to be reporting. It seems you prefer to address the first way instead? That's valid, of course. It would be helpful to know what you think as a maintainer:
I was referring to try-catch blocks around every call, or some app state that tracks disposal of the controller (since afaik there is no field or getter on the controller to check whether the instance has been disposed). So, for example:
becomes
Admittedly not a lot of boilerplate in this case, but in more complex cases where we can't just return, it could mean more code than that.
stuartmorgan-g commentedon May 5, 2025
There's no scenario where clients should be writing try/catch to handle calling into a disposed object; they should not be making the call in the first place. We would not throw exceptions intentionally, because it's a programming error.
I'm not sure I follow. The only way to call a disposed controller would be to have a long-lived controller reference. Why would the client solution not be to simply null out that reference when the controller is disposed? I don't see why additional state would be required.
stuartmorgan-g commentedon May 5, 2025
If we don't actually have any instances of current errors within the plugin, we can treat this as just covering improving the client error. I may have just misread a stack during triage and thought we did have a plugin error somewhere.
filiph commentedon May 6, 2025
You're right. I thought maybe the client might want to distinguish between controller being
nullbecause it hasn't been assigned to yet, and between controller beingnullbecause it's been disposed. But I think we can safely assume that all other callbacks (likeonCameraMove) will always be called afteronMapCreated, so I can't imagine a scenario where this distinction would be useful. Apologies for over-complicating this.JamesMcIntosh commentedon May 8, 2025
@stuartmorgan-g Looking back at the stack trace for the original issue, it stems from a
didUpdateWidget, inside this method there are many calls to update the map using the controller.Each of these methods follow this pattern
Each time there is awaiting for the
GoogleMapControllerit opens the door for the map instance to have been disposed before the controller method is called.There should be a
mountedcheck before calling the controller method and I'll also recommend to lookup and reuse the controller by passing it into these update methods.I have tested and verified that this is the problem by adding logging to
didUpdateWidgetanddispose.For me this error occurs very often on the web version of our Flutter app as it is easy to switch pages while the map is still initializing.
I'm just added a PR now to address this - #9227
JamesMcIntosh commentedon May 8, 2025
This is the one of the exceptions caused when the controller has been disposed when calling
didUpdateWidget.The stack can be any of the update methods inside
didUpdateWidget.This is the other exception which I observed where the controller is looked up after the
GoogleMapsController.initfuture completes and calls_updateTileOverlaysfiliph commentedon May 12, 2025
Was this link perhaps garbled? It links to an issue that seems unrelated at first glance.
JamesMcIntosh commentedon May 12, 2025
I've fixed up the link as the PR is in the packages repository
flutter/packages#9227
[google_maps_flutter] Fixes exception when dispose is called while as…
[google_maps_flutter] Raise `MapUsedAfterWidgetDisposedError` when ma…
github-actions commentedon Nov 18, 2025
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.[google_maps_flutter] Raise `MapUsedAfterWidgetDisposedError` when ma…