ManagedDataModel.fromCurrentMirrorSystem constructor Null safety


Creates an instance of a ManagedDataModel from all subclasses of ManagedObject in all libraries visible to the calling library.

This constructor will search every available package and file library that is visible to the library that runs this constructor for subclasses of ManagedObject. A ManagedEntity will be created and stored in this instance for every such class found.

Standard Dart libraries (prefixed with 'dart:') and URL-encoded libraries (prefixed with 'data:') are not searched.

This is the preferred method of instantiating this type.


ManagedDataModel.fromCurrentMirrorSystem() {
  final runtimes = RuntimeContext.current.runtimes.iterable

  runtimes.forEach((runtime) {
    _entities[runtime.entity.instanceType] = runtime.entity;
    _tableDefinitionToEntityMap[runtime.entity.tableDefinition] =
  runtimes.forEach((runtime) => runtime.finalize(this));