withEntry<T extends ContextEntry> method

Context withEntry <T extends ContextEntry>(
  1. T entry
)

Create a Context with entry added to the existing entries.

Implementation

Context withEntry<T extends ContextEntry>(T entry) {
  if (entry != null && T != entry.runtimeType) {
    throw ArgumentError.value(
      entry,
      "entry",
      "must be exactly of type '${T}'",
    );
  }

  return Context.fromMap(
    <Type, ContextEntry>{
      ..._context,
      T: entry,
    },
  );
}