Skip to content

Restrict expression parsing to formatString, and simplify DataModel#733

Merged
gspencergoog merged 1 commit intoflutter:feature/v0.9-migrationfrom
gspencergoog:migration2
Feb 19, 2026
Merged

Restrict expression parsing to formatString, and simplify DataModel#733
gspencergoog merged 1 commit intoflutter:feature/v0.9-migrationfrom
gspencergoog:migration2

Conversation

@gspencergoog
Copy link
Copy Markdown
Collaborator

Refactor evaluate to resolve and restrict expression parsing.

Also, this change refactors the DataModel API to be an abstract interface, with InMemoryDataModel as the default implementation. It enforces the use of DataPath for all path-based operations, improving type safety and reducing string parsing overhead.

Key changes:

  • DataModel is now an abstract interface class.
  • InMemoryDataModel provides the concrete implementation.
  • DataPath is required for update, subscribe, and getValue operations.
  • DataModel.bindExternalState now returns a disposal function for easier cleanup.
  • ExpressionParser updated to return Stream<String> consistently for string interpolation.
  • Added DataModelTypeException for runtime type mismatches in getValue.
  • Updated travel_app and tests to reflect these API changes.
  • Renamed DataContext.evaluate to resolve and ensured it always returns Stream<Object?>.
  • Removed implicit expression parsing from DataModel.getValue and subscribe. They now only accept paths.
  • Moved ExpressionParser logic to lib/src/functions/format_string.dart and restricted its usage to FormatStringFunction.
  • Updated WidgetUtilities to use resolve via resolveContext and handle stream subscriptions correctly.
  • Updated Button, TextField, and ValidationHelper to await resolve results.
  • Updated travel_app and genui tests to reflect these changes.
  • Fixed DataModel to handle empty argument lists in function calls to prevent stalled streams.
  • Fixed async error handling in Surface and associated tests.

gemini-code-assist[bot]

This comment was marked as resolved.

gemini-code-assist[bot]

This comment was marked as resolved.

- Fix infinite loop in `_notifySubscribers` when handling relative paths.
- Ensure `subscribeStream` disposes of underlying `ValueNotifier`.
- Dispose source notifiers in `_ToStringNotifier`, `_ToBoolNotifier`, `_ToNumberNotifier`.
- Fix `image_test.dart` to properly mock `HttpClient` and use `errorBuilder` in `Image` widget.
- Update `audio_player_test.dart` to match current implementation.
- Apply minor formatting fixes in `travel_app`.
- Pass absolutePath to _checkType for more accurate error reporting.
- Refactor catalog widgets to use BoundValue/BoundString for lifecycle safety
- Replaced explicit `subscribeTo*` calls with `Bound*` widgets across `genui` and `travel_app` catalog widgets.
- Introduced `BoundObject` in `widget_utilities.dart` to handle generic object binding.
- Removed `subscribeTo*` extension methods from `widget_utilities.dart` to prevent misuse and memory leaks.
- Fixed `choice_picker.dart` to use `BoundObject` instead of abstract `BoundValue`.
- `DataModel` is now an `abstract interface class`.
- `InMemoryDataModel` provides the concrete implementation.
- `DataPath` is required for `update`, `subscribe`, and `getValue` operations.
- `DataModel.bindExternalState` now returns a disposal function for easier cleanup.
- `ExpressionParser` updated to return `Stream<String>` consistently for string interpolation.
- Added `DataModelTypeException` for runtime type mismatches in `getValue`.
- Updated `travel_app` and tests to reflect these API changes.
- Renamed `DataContext.evaluate` to `resolve` and ensured it always returns `Stream<Object?>`.
- Removed implicit expression parsing from `DataModel.getValue` and `subscribe`. They now only accept paths.
- Moved `ExpressionParser` logic to `lib/src/functions/format_string.dart` and restricted its usage to `FormatStringFunction`.
- Updated `WidgetUtilities` to use `resolve` via `resolveContext` and handle stream subscriptions correctly.
- Updated `Button`, `TextField`, and `ValidationHelper` to await `resolve` results.
- Updated `travel_app` and `genui` tests to reflect these changes.
- Fixed `DataModel` to handle empty argument lists in function calls to prevent stalled streams.
- Fixed async error handling in `Surface` and associated tests.
@gspencergoog gspencergoog merged commit c107f49 into flutter:feature/v0.9-migration Feb 19, 2026
1 check passed
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

Successfully merging this pull request may close these issues.

1 participant