ClientNotification.fromJson constructor
Reads the branch json names; an unrecognised one is kept as UnknownClientNotification.
Implementation
factory ClientNotification.fromJson(Map<String, Object?> json) {
switch (json['method']) {
case 'notifications/cancelled':
return CancelledNotification.fromJson(json);
case 'notifications/initialized':
return InitializedNotification.fromJson(json);
case 'notifications/progress':
return ProgressNotification.fromJson(json);
case 'notifications/roots/list_changed':
return RootsListChangedNotification.fromJson(json);
case 'notifications/tasks/status':
return TaskStatusNotification.fromJson(json);
case 'notifications/tasks':
return TaskStatusNotification.fromJson(json);
}
return UnknownClientNotification.fromJson(json);
}