readFscene function
Parses a .fscene document from source.
Accepts a JSONC superset on read (// and /* */ comments, trailing
commas), runs the version migration chain, then decodes. Pass migrations
to override the built-in chain (for tests). Unknown fields are ignored.
Implementation
SceneDocument readFscene(String source, {List<FsceneMigration>? migrations}) {
final decoded = jsonDecode(stripJsonc(source));
if (decoded is! Map) {
throw const FsceneFormatException('Top-level value must be an object');
}
final migrated = migrateFscene(
Map<String, dynamic>.from(decoded),
migrations: migrations,
);
return decodeDocument(migrated);
}