fromCollection static method
Constructs an APIConfig instance from a collection o
, or return def
.
Implementation
static APIConfig? fromCollection(Object? o, [dynamic def]) {
if (o == null) {
return APIConfig.fromSync(def);
}
if (o is Map<String, dynamic>) {
return APIConfig(o);
}
if (o is Map) {
return APIConfig(o.map((key, value) => MapEntry('$key', value)));
} else if (o is Iterable) {
var map = Map<String, dynamic>.fromEntries(o.expand(_toMapEntry));
return APIConfig(map);
}
return APIConfig.fromSync(def);
}