urlForModel<_Model extends RestModel> method

  1. @protected
String? urlForModel<_Model extends RestModel>(
  1. Query? query, [
  2. _Model? instance
])

Given a model instance and a query, produce a fully-qualified URL

Implementation

@protected
String? urlForModel<_Model extends RestModel>(Query? query, [_Model? instance]) {
  assert(
    modelDictionary.adapterFor.containsKey(_Model),
    'REST provider does not contain $_Model',
  );
  final adapter = modelDictionary.adapterFor[_Model];
  final endpoint = adapter?.restEndpoint(query: query, instance: instance);

  if (endpoint?.isEmpty != false) return null;
  return baseEndpoint + endpoint!;
}