From 144c5e3f1f5800c2b39c86d5a5affc8e59f1dc01 Mon Sep 17 00:00:00 2001 From: Tommy Chow Date: Sun, 8 Mar 2026 21:31:47 -0700 Subject: [PATCH] fix stream info mutations outside MobX action context Co-Authored-By: Claude Opus 4.6 --- .../channel/video/native_video_store.dart | 27 +++++++++++-------- pubspec.lock | 2 +- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/lib/screens/channel/video/native_video_store.dart b/lib/screens/channel/video/native_video_store.dart index f9feddce..ae21c771 100644 --- a/lib/screens/channel/video/native_video_store.dart +++ b/lib/screens/channel/video/native_video_store.dart @@ -435,18 +435,23 @@ abstract class NativeVideoStoreBase with Store implements VideoPlayerInterface { Future _updateStreamInfoInternal() async { try { - _streamInfo = await twitchApi.getStream(userLogin: userLogin); - _offlineChannelInfo = null; - } catch (e) { - _overlayTimer?.cancel(); - _streamInfo = null; - _paused = true; - - try { - _offlineChannelInfo = await twitchApi.getChannel(userId: userId); - } catch (_) { + final info = await twitchApi.getStream(userLogin: userLogin); + runInAction(() { + _streamInfo = info; _offlineChannelInfo = null; - } + }); + } catch (e) { + Channel? channel; + try { + channel = await twitchApi.getChannel(userId: userId); + } catch (_) {} + + runInAction(() { + _overlayTimer?.cancel(); + _streamInfo = null; + _paused = true; + _offlineChannelInfo = channel; + }); } } diff --git a/pubspec.lock b/pubspec.lock index 1f4357c6..d4a5fb57 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -102,7 +102,7 @@ packages: description: path: "." ref: frosty-patches - resolved-ref: "8d770ac28dfe76a0d6adf521daee138253e4ea89" + resolved-ref: cc173d8329f79f12960dd7280ef2709496ff0ef0 url: "https://github.com/tommyxchow/flutter-native-video-player.git" source: git version: "0.4.11"