restage_shared 2.0.0
restage_shared: ^2.0.0 copied to clipboard
Pure-Dart Remote Flutter Widget (RFW) catalog format, schemas, validation, and shared value types used across the Restage packages.
restage_shared example #
restage_shared is the pure-Dart spine shared between the Restage SDK and the
build-time toolchain: catalog format types, surface/flow documents, value
types, the analytics taxonomy, plus validation and codecs. There is no Flutter
dependency, so the same types compile in a Flutter app, in a command-line tool,
or in a pure-Dart server.
Decode and inspect a catalog (pure Dart) #
Because there is no Flutter dependency, you can decode and walk a catalog anywhere, for example in a command-line tool or a server:
import 'dart:io';
import 'package:restage_shared/restage_shared.dart';
void main(List<String> args) {
final json = File(args.first).readAsStringSync();
// decodeCatalog validates the canonical JSON as it parses; an invalid
// catalog throws rather than producing a malformed Catalog.
final Catalog catalog = decodeCatalog(json);
for (final WidgetEntry widget in catalog.widgets) {
stdout.writeln(widget.name);
}
}
The package also carries the SurfaceDocument / FlowDocument wire formats
and the analytics event taxonomy. Both sides read the same definitions, so a
surface authored on one decodes byte-for-byte on the other.
See the package README for the full type inventory.