DataSource class
DataSource layer annotation - indicates data source components
This annotation is a specialization of @Component for classes that
provide direct data access functionality, such as API clients,
database connections, or external service integrations.
DataSources are typically the lowest level in the data layer, handling the actual data retrieval and storage mechanisms.
Example:
@DataSource()
class UserApiDataSource {
Future<Map<String, dynamic>> fetchUser(String id) async {
// API call logic here
return await httpClient.get('/users/$id');
}
}
@DataSource()
class UserLocalDataSource {
Future<Map<String, dynamic>?> getUserFromCache(String id) async {
// Local storage logic here
return await localStorage.get('user_$id');
}
}
Constructors
- DataSource([String? value])
-
Creates a DataSource annotation
const
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited