Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The following PlatformException was thrown while de-activating platform stream on channel #8

Closed
locskot opened this issue May 14, 2021 · 1 comment

Comments

@locskot
Copy link

locskot commented May 14, 2021

flutter: ══╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ╞══════════════════════════════════════════════════════════
flutter: The following PlatformException was thrown while de-activating platform stream on channel
flutter: cindyu.com/all_sensors/proximity:
flutter: PlatformException(error, No active stream to cancel, null, null)
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:581:7)
flutter: #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:158:18)
flutter:
flutter: #2 EventChannel.receiveBroadcastStream. (package:flutter/src/services/platform_channel.dart:557:9)
flutter:
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════

[✓] Flutter (Channel stable, 2.0.6, on macOS 11.3.1 20E241 darwin-arm, locale ru-RU)
• Flutter version 2.0.6 at /users/locskot/dev/sdk/Flutter
• Framework revision 1d9032c7e1 (2 weeks ago), 2021-04-29 17:37:58 -0700
• Engine revision 05e680e202
• Dart version 2.12.3

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/locskot/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5, Build version 12E262
• CocoaPods version 1.10.1

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.52.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.20.0

[✓] Connected device (3 available)
• Redmi 4A (mobile) • fd31e04a7d54 • android-arm64 • Android 7.1.2 (API 25)
• iPhone SE (mobile) • 6087e5ee38d6e1feb9d89a20cbb4f79442e6b34d • ios • iOS 14.5.1
• Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.212

• No issues found!

@locskot
Copy link
Author

locskot commented May 17, 2021

The problem was with two subscriptions which go almost simultaneously. So I did the following changes in the top of the widget tree:

final proximitySubject = PublishSubject();
proximitySubscription.clear();
proximitySubscription.add(proximityEvents.listen(proximitySubject.add));

and then observe the proximitySubject wherever I need proximityEvents;

@locskot locskot closed this as completed May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant