fromJson static method
Reads back what toJson wrote, or null for a shape this build has no member for.
Null rather than a throw, for the reason _platformsOf gives on the app
side: the config imports the flutterware version the project pins,
which can run ahead of the GUI reading its manifest. A source we cannot
resolve has to mean a knob with fewer suggestions, never a knob that
disappears.
Implementation
static DefineSource? fromJson(Object? raw) {
if (raw is! Map) return null;
if (raw['source'] == 'hostAddresses') return hostAddresses;
if (raw['source'] == 'flutterSdk') return flutterSdk;
if (raw['script'] case String path) {
return ScriptSource(
path,
args: [
for (var arg in (raw['args'] as List? ?? const []))
if (arg is String) arg,
],
);
}
return null;
}