A Flutter app that uses the "Veegil's bank" API to fetch user's data and their finance activities.
You can run the app by just typing flutter run
on your console or adding the --release
argument to build a lighter version of the app
(A simple view of the bank app's UI,
The code of the app applies clean architecture approach to separate the UI, services and data models folder structure.
lib
├── models
├── services
├── ui
│ ├── components
│ ├── pages
│ │ └── visuals
│ └── utils
├── locator.dart
└── main.dart
main.dart
file has services initialization code, wraps the rootSimpleBankApp
with aProviderScope
and has theMaterialApp
- The
models
folder contains the data structure for incoming data given by the API services
folder contains the functions fetches the API data necessary for apps ui *Theui
folder contains the app designscomponents
folder holds reusable designs that avoids repetition
Using Riverpod Provider
and GetIt
to access the Services implementation:
final transationsStream =
ref.watch(locator.get<TransactionsService>().transactionProvider);
access implementation from the endpoint using a Future Function
:
final transactionProvider = FutureProvider((ref) => getTransactions());
static Future<TransactionsModel> getTransactions() async {
Response response;
try {
response = await _dio.get('$baseUrl/transactions');
if (response.statusCode == 200) TransactionsModel.fromJson(response.data);
} on DioError catch (error) {
if (error.response != null) {
throw throw error.response?.statusMessage ?? 'Unexpected result';
}
throw 'Check your Internet Connection';
}
return TransactionsModel.fromJson(response.data);
}