NIMResult<T>.fromMap constructor
NIMResult<T>.fromMap (
- Map<
String, dynamic> map, { - NIMResultDataConvert<
T> ? convert,
Implementation
factory NIMResult.fromMap(Map<String, dynamic> map,
{NIMResultDataConvert<T>? convert}) {
var data = map['data'];
var code = map['code'];
var errorDetails = map['errorDetails'];
if (data != null && convert != null) {
final result = NIMResult(
code, convert(Map<String, dynamic>.from(data)), errorDetails);
assert(() {
result._sourceMap = map;
return true;
}());
return result;
} else {
return NIMResult(code, data as T?, errorDetails);
}
}