Hello,
I'm developing Flutter web app using mobx (mobx: 1.0.2, flutter_mobx: 1.0.1, mobx_codegen: 1.0.2) and I'm experiencing the issue of:
Invalid argument: Maximum call stack size exceeded .
My store's code is almost identical as the github app code from repo's examples:
List<Item> items = [];
static ObservableFuture<List<Item>> emptyResponse = ObservableFuture.value([]);
@observable
ObservableFuture<List<Item>> _itemsFuture = emptyResponse;
@computed
bool get hasResults =>
_itemsFuture != emptyResponse &&
_itemsFuture.status == FutureStatus.fulfilled;
@action
Future<List<Item>> fetchItems() async {
items = [];
final future = itemsService.getAll();
_itemsFuture = ObservableFuture(future);
items = await future;
return items;
}
The problematic part seems to be the usage of @action returning a Future, because even replacing the fetchItems action with code like:
@action
Future<List<Job>> fetchItems() async {
items = [];
sleep(Duration(seconds: 1));
return items;
}
results with the same output: Invalid argument: Maximum call stack size exceeded. Complete removal of that @action returning Future "solves" the issue, but the app does not get the data = doesn't work.
Any code change if followed by flutter clean and of course flutter packages pub run build_runner build --delete-conflicting-outputs.
What may be done wrong here?
Cheers!
Flutter doctor output:
[✓] Flutter (Channel beta, v1.14.6, on Mac OS X 10.14.6 18G3020, locale pl-PL)
[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.5)
[✓] IntelliJ IDEA Community Edition (version 2017.3.5)
[✓] VS Code (version 1.41.1)
[✓] Connected device (3 available)
Hello,
I'm developing Flutter web app using mobx (
mobx: 1.0.2, flutter_mobx: 1.0.1, mobx_codegen: 1.0.2) and I'm experiencing the issue of:Invalid argument: Maximum call stack size exceeded.My store's code is almost identical as the github app code from repo's examples:
The problematic part seems to be the usage of
@actionreturning a Future, because even replacing thefetchItemsaction with code like:results with the same output:
Invalid argument: Maximum call stack size exceeded. Complete removal of that @action returning Future "solves" the issue, but the app does not get the data = doesn't work.Any code change if followed by
flutter cleanand of courseflutter packages pub run build_runner build --delete-conflicting-outputs.What may be done wrong here?
Cheers!
Flutter doctoroutput: