IOpenable class abstract
Interface for components that require explicit opening and closing.
For components that perform opening on demand consider using
ICloseable
interface instead.
Example
class MyPersistence implements IOpenable {
dynamic _client;
...
bool isOpen() {
return _client != null;
}
Future open(String correlationId) {
if (isOpen()) {
return Future(Duration(), (){
})
}
...
}
Future close(String correlationId) async {
if (_client != null) {
result = await _client.close();
_client = null;
Future(Duration(), (){ return result})
}
}
...
}
- Implemented types
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
String? correlationId) → Future -
Closes component and frees used resources.
inherited
-
isOpen(
) → bool - Checks if the component is opened.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
open(
String? correlationId) → Future - Opens the component.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited