diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index 5b82a44bc..6653dddf8 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -3742,7 +3742,8 @@ class CursorModel with ChangeNotifier { final generation = _generation; () async { try { - // Never at once: a build may be what asked, and a failure tells the listeners. + // A throw becomes an error the await hands over later, not during the build that may + // have asked: a failure tells the listeners. final shape = await Future.sync(() => fetchCursorShape(id)); if (generation != _generation) { return; diff --git a/flutter/test/cursor_default_test.dart b/flutter/test/cursor_default_test.dart index 07f4fdc6c..1357a6802 100644 --- a/flutter/test/cursor_default_test.dart +++ b/flutter/test/cursor_default_test.dart @@ -54,7 +54,8 @@ void main() { final evt = {'id': '2'}; ffi.ffiModel.updateLastCursorId(evt); ffi.ffiModel.handleCursorId(evt); - await Future.delayed(const Duration(milliseconds: 100)); + // Not a wait for the default cursor itself: asking for it would make it. + await Future.delayed(const Duration(milliseconds: 500)); expect(cursor.cache, isNull); final built = _key(buildCursorOfCache( cursor, 1.0, cursor.cache ?? preDefaultCursor.cache));