PromptResult.fromJson constructor
PromptResult.fromJson(
- JSONMap json
Implementation
factory PromptResult.fromJson(JSONMap json) {
final cmd = json['cmd'] ?? json['error'];
switch (cmd) {
case 'notification':
return PromptResult(
type: PromptType.notification,
value: Notification.fromJson(json),
);
case 'confirm':
return PromptResult(
type: PromptType.confirm,
value: Confirm.fromJson(json),
);
case 'progress':
return PromptResult(
type: PromptType.progress,
value: Progress.fromJson(json),
);
default:
return PromptResult(
type: PromptType.confirm,
value: null,
);
}
}