fromJson static method
Tolerant of everything except a wrong shape, like every other decoder that reads a manifest a previous version of flutterware wrote.
A missing or non-string field is no identity rather than a throw: the worst this costs is a window that looks like every other window, which is exactly where the project started. Refusing to open it would be worse.
Note this arm is mostly unreachable in practice — tool/flutterware.dart
is Dart, so a config that omits a required argument fails to compile and is
reported as the compile error it is, long before anything decodes.
Implementation
static ProjectIdentity? fromJson(Map<String, Object?> json) =>
switch ((json['package'], json['icon'])) {
(String path, String icon) when path.isNotEmpty && icon.isNotEmpty =>
ProjectIdentity(package: Pkg(path), icon: icon),
_ => null,
};