Platform.fromJson constructor
Platform.fromJson(
- Map<String, dynamic> json
)
Implementation
factory Platform.fromJson(Map<String, dynamic> json) {
switch (json['type']) {
case 'web':
return Platform.web(
currentUrl: json['currentUrl'],
isMobile: json['isMobile'],
isOnline: json['isOnline'],
);
case 'android':
return Platform.android(
packageId: json['packageId'],
sha1Cert: json['sha1Cert'],
isOnline: json['isOnline'],
);
case 'ios':
return Platform.ios(
appId: json['appId'],
isOnline: json['isOnline'],
);
case 'macos':
return Platform.macos(
appId: json['appId'],
isOnline: json['isOnline'],
);
case 'linux':
return Platform.linux(
isOnline: json['isOnline'],
);
case 'windows':
return Platform.windows(
isOnline: json['isOnline'],
);
}
throw ArgumentError('Unknown platform ${json['type']}');
}