setField method

void setField(
  1. O o,
  2. String key,
  3. Object? value, {
  4. EntityHandler<O>? entityHandler,
  5. EntityCache? entityCache,
})

Implementation

void setField(O o, String key, Object? value,
    {EntityHandler<O>? entityHandler, EntityCache? entityCache}) {
  if (o is Entity) {
    o.setField(key, value);
  } else if (entityHandler != null) {
    entityHandler.setField(o, key, value, entityCache: entityCache);
  } else if (o is Map) {
    o[key] = value;
  } else {
    throw StateError('setField($key): No EntityHandler provided for: $o');
  }
}