fromDynamic static method
Processes a Map or Map-like object into a response. If the map is null then this will return null.
Implementation
static CommandResponse? fromDynamic(dynamic map) {
CommandResponse? result;
if (map != null) {
final type = map['type'];
final builder = _builders[type];
result = CommandResponse(
message: map['message'],
payload: map['payload'],
success:
map['success'] == null ? null : JsonClass.parseBool(map['success']),
type: map['type'],
);
if (builder != null) {
result = builder(map['payload'], result.message, result.success);
}
}
return result;
}