from static method

APIHandler from(
  1. View view,
  2. Map<String, API> apis,
  3. YamlMap map
)

Implementation

static APIHandler from(View view, Map<String, API> apis, YamlMap map) {
  if (!apis.containsKey(map['api'])) {
    throw Exception('api with name=' + map['api'] + ' not define');
  }
  API api = apis[map['api']]!;
  Map<String, String>? paramMetaValues = HashMap();
  if (map.containsKey('parameters')) {
    map['parameters'].forEach((k, v) {
      paramMetaValues[k.toString()] = v.toString();
    });
  }
  return APIHandler(api, paramMetaValues, map['success'], map['error']);
}