IOpenable class
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. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
isOpen(
) → bool - Checks if the component is opened. [...]
-
open(
String correlationId) → Future - Opens the component. [...]
-
close(
String correlationId) → Future -
Closes component and frees used resources. [...]
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
inherited