parse<T> static method

DataSourceCall<T>? parse<T>(
  1. String? call
)

Implementation

static DataSourceCall<T>? parse<T>(String? call) {
  if (call == null) return null;

  var match = CALL_PATTERN.firstMatch(call);

  if (match == null) return null;

  var id = match.group(1);

  var operationName = match.group(2) ?? 'get';

  var operation = getDataSourceOperation(operationName);
  if (operation == null) return null;

  var parametersStr = (match.group(3) ?? '').trim();

  var parameters = decodeQueryString(parametersStr);

  var dataSourceCall =
      DataSourceCall.byDataSourceID(id, operation, parameters);
  return dataSourceCall as DataSourceCall<T>;
}