StagedViewport.fromJson constructor
Implementation
factory StagedViewport.fromJson(Map<String, Object?> json) => StagedViewport(
width: (json['width']! as num).toDouble(),
height: (json['height']! as num).toDouble(),
pixelRatio: (json['pixelRatio'] as num?)?.toDouble() ?? 1,
insetTop: (json['insetTop'] as num?)?.toDouble() ?? 0,
insetRight: (json['insetRight'] as num?)?.toDouble() ?? 0,
insetBottom: (json['insetBottom'] as num?)?.toDouble() ?? 0,
insetLeft: (json['insetLeft'] as num?)?.toDouble() ?? 0,
platform: switch (json['platform']) {
String name => DevicePlatform.values.firstWhere(
(platform) => platform.name == name,
),
_ => null,
},
keyboard: (json['keyboard'] as num?)?.toDouble() ?? 0,
keyboardUp: json['keyboardUp'] == true,
);