A survey app developed with clean architecture and SOLID principles in mind
Table of Contents
This was originally built using Flutter 1.22.6 and on March 3rd was upgraded to Flutter 2.0.0. Though, the code was not migrated to null safety yet.
The swagger documentation for the backend the app communicate with can be found here
- Meta: Annotations for Static Analysis
- Http: A composable, Future-based library for making HTTP requests.
- Provider: A wrapper around InheritedWidget to make them easier to use and more reusable.
- Equatable: An abstract class that helps to implement equality without needing to explicitly override == and hashCode.
- Get: Open screens/snackbars/dialogs without context, manage states and inject dependencies easily with GetX.
- Pay attention that I'm using version
3.4.2
exactly.
- Pay attention that I'm using version
- Flutter Secure Storage: provides API to store data in secure storage. Keychain is used in iOS, KeyStore based solution is used in Android.
- We need to modify the minSdkVersion to 18 in the
build.gradle
file in the Android project
- We need to modify the minSdkVersion to 18 in the
- Local Storage: Simple json file-based storage for flutter
- Carousel Slider: A carousel slider widget.
- Intl: Contains code to deal with internationalized/localized messages, date and number formatting and parsing, bi-directional text, and other internationalization issues.
- Used in this project for Date conversions.
- Test: provides a standard way of writing and running tests in Dart.
- Mockito: Mock library for Dart inspired by the Java's Mockito library.
- Faker: A library for Dart that generates fake data.
- Network Image Mock: Utility for providing mocked Image.network response in Flutter widget tests.
- the widget
Image.network
will throw an exception if we run them on tests. This library helps us mocking them. - another library the does the same but for the Mocktail test library is mocktail_image_network.
- the widget
- Flutter Launcher Icons: A command-line tool which simplifies the task of updating your Flutter app's launcher icon. More complex settings with flavors can be found here.
- the configuration done can be found at the end of the pubspec.yaml file.
- more pieces of information about adaptive icons can be found here.
- you need to run the command specified in the library's docs:
flutter pub run flutter_launcher_icons:main
Answered and not already answered.
On the Run tab at the left side you can create a launch.json
configuration to run the application as well as their tests. You can add default configuration too, such as
Flutter run all tests, so you can run all the tests by pressing F5.
{
"version": "0.2.0",
"configurations": [
{
"name": "Flutter: Run all Tests",
"type": "dart",
"request": "launch",
"program": "./test/"
},
{
"name": "flutter_clean_arch",
"request": "launch",
"type": "dart",
"program": "./lib/main/main.dart"
}
]
}
Also, it was created a snippets to help initialize the boilerplate for tests.
To create a snippet, goes to File -> Preferences -> User Snippets
and then
create a dart.json
file. The snippet create use darttest
as a shortcut.
{
"Dart unit tests": {
"prefix": "darttest",
"body": [
"import 'package:test/test.dart';",
"",
"void main() {",
" test('', () {});",
"}"
],
"description": "Initial boilerplate for Dart test code"
},
"Flutter Widget tests": {
"prefix": "fluttertest",
"body": [
"import 'package:flutter_test/flutter_test.dart';",
"",
"void main() {",
" testWidgets('', (WidgetTester tester) async {",
"",
" });",
"}"
],
"description": "Initial boilerplate for Flutter Wiget test"
},
}
- This article shows several design patterns applied to Flutter.
- CI workflow: here and here
This project is licensed under the terms of the MIT License © Pablo Satler 2021