LinkMode.fromJson constructor
Constructs a LinkMode from the given json
.
The json is expected to be valid encoding obtained via LinkMode.toJson.
Implementation
factory LinkMode.fromJson(Map<String, Object?> json) {
final type = json['type'];
return switch (type) {
'static' => StaticLinking._singleton,
'dynamic_loading_process' => LookupInProcess._singleton,
'dynamic_loading_executable' => LookupInExecutable._singleton,
'dynamic_loading_bundle' => DynamicLoadingBundled._singleton,
'dynamic_loading_system' =>
DynamicLoadingSystem(Uri.parse(json['uri'] as String)),
_ => throw FormatException('The link mode "$type" is not known'),
};
}