ServiceRegistry class Null safety
An object that manages the cleanup of service objects when an application is stopped.
You register objects with the registry to provide automatic cleanup of service objects. When an application is stopped (typically during testing), all registered objects are destroyed in an object-specific way.
Services that open ports will stop an application from stopping gracefully, so it is important that your application releases them when stopping.
Built-in Conduit types that open a stream, like PersistentStore, automatically register themselves when instantiated. If you are unsure whether an object has already been registered, you may re-register it - multiple registrations have no effect.
) → Future
- Cleans up all registered objects. [...]
Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
T>( T object, FutureOr onClose(T object)) → T
objectto be destroyed when your application is stopped. [...]
) → String
A string representation of this object. [...]
dynamic object) → void
- Removes an object from the registry. [...]