Context.fromMap constructor

Context.fromMap(
  1. Map<Type, ContextEntry?> context
)

Creates a context from initial values represented as a map

Every values runtime Type must be exactly the Type defined by the key.

Implementation

factory Context.fromMap(Map<Type, ContextEntry?> context) {
  assert(
    context.entries.every(
      (entry) => entry.value == null || entry.value.runtimeType == entry.key,
    ),
    "Every values runtime type must be exactly the key",
  );

  return Context._fromMap(context);
}