cph-cachet / flutter-plugins

A collection of Flutter plugins developed by CACHET
537 stars 642 forks source link

[screen_state 1.0.0] - MissingPluginException(No implementation found for method cancel on channel screenStateEvents) #188

Closed bardram closed 3 years ago

bardram commented 3 years ago

Device / Emulator and OS

Please complete the following information for each phone and/or emulator you're experiencing this bug on:

Describe the bug

I've added support for stopping / starting the screenStateStream subscription in the example app. This is committed.

When canceling a stream subscription and later trying to listen again, I get

══╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ╞══════════════════════════════════════════════════════════
The following MissingPluginException was thrown while activating platform stream on channel
screenStateEvents:
MissingPluginException(No implementation found for method listen on channel screenStateEvents)

When the exception was thrown, this was the stack:
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:159:7)
<asynchronous suspension>
#1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:334:12)
#2      EventChannel.receiveBroadcastStream.<anonymous closure> (package:flutter/src/services/platform_channel.dart:542:29)
#3      EventChannel.receiveBroadcastStream.<anonymous closure> (package:flutter/src/services/platform_channel.dart:528:64)
#11     _MyAppState.startListening (package:screen_state_example/main.dart:34:49)
#12     _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:992:19)
#13     _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:1098:38)
#14     GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:184:24)
#15     TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:524:11)
#16     BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:284:5)
#17     BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:256:7)
#18     GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:158:27)
#19     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:224:20)
#20     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:200:22)
#21     GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:158:7)
#22     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:104:7)
#23     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:88:7)
#27     _invoke1 (dart:ui/hooks.dart:267:10)
#28     _dispatchPointerDataPacket (dart:ui/hooks.dart:176:5)
(elided 10 frames from dart:async)
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by services library ══════════════════════════════════════════════════════
The following MissingPluginException was thrown while activating platform stream on channel screenStateEvents:
MissingPluginException(No implementation found for method listen on channel screenStateEvents)

When the exception was thrown, this was the stack: 
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:159:7)
<asynchronous suspension>
#1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:334:12)
#2      EventChannel.receiveBroadcastStream.<anonymous closure> (package:flutter/src/services/platform_channel.dart:542:29)
#3      EventChannel.receiveBroadcastStream.<anonymous closure> (package:flutter/src/services/platform_channel.dart:528:64)
...
════════════════════════════════════════════════════════════════════════════════════════════════════

A similar thing can also happen when calling cancel on the subscription.

Another exception was thrown: MissingPluginException(No implementation found for method cancel on channel screenStateEvents)

════════ Exception caught by services library ══════════════════════════════════════════════════════
The following MissingPluginException was thrown while de-activating platform stream on channel screenStateEvents:
MissingPluginException(No implementation found for method cancel on channel screenStateEvents)

When the exception was thrown, this was the stack: 
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:159:7)
<asynchronous suspension>
#1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:334:12)
#2      EventChannel.receiveBroadcastStream.<anonymous closure> (package:flutter/src/services/platform_channel.dart:554:29)
#3      EventChannel.receiveBroadcastStream.<anonymous closure> (package:flutter/src/services/platform_channel.dart:551:18)
...
════════════════════════════════════════════════════════════════════════════════════════════════════

To Reproduce

  1. Run the new example app
  2. Use the new floating button to stop the subscription
  3. Start the subscription
  4. The exception occurs.
  5. Click stop
  6. The exception occurs again (this time with cancel)

Expected behavior

I expect to be able to start and cancel subscriptions on the stream (normal stream behavior).

thomasnilsson commented 3 years ago

I have spent a long time on this today and the error persists - not sure if this could be related to a Flutter API update. Never encountered this issue before!

bardram commented 3 years ago

It's still pretty important - we have an issue in CAMS refering to this problem

thomasnilsson commented 3 years ago

Fixed in version 1.0.1