fix stream info mutations outside MobX action context

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Tommy Chow 2026-03-08 21:31:47 -07:00
parent cb79dfd233
commit 144c5e3f1f
2 changed files with 17 additions and 12 deletions

View file

@ -435,18 +435,23 @@ abstract class NativeVideoStoreBase with Store implements VideoPlayerInterface {
Future<void> _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;
});
}
}

View file

@ -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"