FlateService class abstract
This mixin should be used in declaring classes that interact with external resources such as a database, files or file system, etc.
Example:
class MyLocationQuery extends FlateService {
late final HttpClient _client;
@override
FutureOr<void> initialize() async {
super.initialize();
_client = HttpClient();
}
@override
FutureOr<void> dispose() async {
_client.close();
super.dispose();
}
Future<Map<String, dynamic>> myIpLocation() async {
final uri = Uri.parse('http://ip-api.com/json/');
final req = await _client.getUrl(uri);
final res = await req.close();
final data = await res.transform(utf8.decoder).join();
return jsonDecode(data);
}
}
- Mixed in 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
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
prepare(
covariant FlateElementProvider provider) → FutureOr< void> -
This method perform instance initialization
inherited
-
register(
Registration registration) → void -
This method used during registration to define set of Type with which this FlateElementMixin will be registered
inherited
-
release(
) → FutureOr< void> -
This method perform instance dispose
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited