detach<T> method

ContextStoreData<T>? detach<T>({
  1. required dynamic key,
})

Detaches and removes data of type T associated with context.

If key is null, the type T is used as the key. The key parameter is deliberately marked as required to ensure the developer deliberately decides whether to provide a key or set it as null.

Returns the removed data if or null if it didn't exist.

Implementation

ContextStoreData<T>? detach<T>({
  required dynamic key,
}) {
  return ContextStore.instance.detach<T>(
    context,
    key: key,
  );
}