tryFrom method

F? tryFrom({
  1. F? field,
  2. R? reference,
  3. O? sharedObject,
  4. String? id,
})

Implementation

F? tryFrom({F? field, R? reference, O? sharedObject, String? id}) {
  if (field != null) {
    return field;
  }

  if (reference != null && sharedObject == null) {
    var oAsync = sharedObjectInstantiator(reference: reference);
    if (oAsync is O) {
      sharedObject = oAsync;
    }
  }

  if (sharedObject != null) {
    return fromSharedObject(sharedObject);
  }

  if (id != null) {
    return fieldInstantiator(id);
  }

  return null;
}