VisionResultData.fromBrowser constructor
VisionResultData.fromBrowser(
- Map<
String, dynamic> json, { - Float64List? landmarks,
Reads the browser worker's reply: its decoded JSON (width, height,
timestamp, result, and counts or parts when the worker packed
the image landmarks) with the packed landmarks it transferred.
Implementation
factory VisionResultData.fromBrowser(
Map<String, dynamic> json, {
Float64List? landmarks,
}) => VisionResultData(
result: json['result'] as Map<String, dynamic>,
width: json['width'] as int,
height: json['height'] as int,
timestamp: json['timestamp'] as int?,
landmarks: landmarks,
counts: (json['counts'] as List?)?.cast<int>(),
parts: switch (json['parts']) {
final List parts => [
for (final entry in parts.cast<List>())
(entry[0] as String, (entry[1] as List).cast<int>()),
],
_ => null,
},
);