morphMap static method

Map<String, ModelDefinition<Model> Function()> morphMap([
  1. Map<String, ModelDefinition<Model> Function()>? map,
  2. bool merge = true
])

Registers morph aliases: a model listed here is stored in *_type columns under its alias ('post') instead of its ModelDefinition.morphClass, and MorphTo resolves the alias back. Returns the current map.

Implementation

static Map<String, ModelDefinition<Model> Function()> morphMap([
  Map<String, ModelDefinition<Model> Function()>? map,
  bool merge = true,
]) {
  if (map != null) {
    if (!merge) {
      _morphMap.clear();
    }
    _morphMap.addAll(map);
  }
  return Map.unmodifiable(_morphMap);
}