fromJson static method
Implementation
static ComputerAction fromJson(Map<String, dynamic> j) {
switch (j['type']) {
case 'click':
return ComputerActionClick(
x: j['x'],
y: j['y'],
button: j['button'],
);
case 'double_click':
return ComputerActionDoubleClick(x: j['x'], y: j['y']);
case 'drag':
return ComputerActionDrag(
path: (j['path'] as List).cast<Map<String, dynamic>>().map((p) => Point(x: p['x'], y: p['y'])).toList(),
);
case 'keypress':
return ComputerActionKeyPress(keys: List<String>.from(j['keys']));
case 'move':
return ComputerActionMove(x: j['x'], y: j['y']);
case 'screenshot':
return const ComputerActionScreenshot();
case 'scroll':
return ComputerActionScroll(
x: j['x'],
y: j['y'],
scrollX: j['scroll_x'],
scrollY: j['scroll_y'],
);
case 'type':
return ComputerActionType(text: j['text']);
case 'wait':
return const ComputerActionWait();
default:
return OtherComputerAction(j);
}
}