Project template used for quickly scaffolding new Flutter based projects that easily integrate with Bedrock back-end while following industry best practices for things like state management, localization & internationalization, unit & widget testing, and much more.
✅ Localization
✅ State management using Cubits with example screens for Shops & Products using Bedrock API.
✅ Authentication using Bedrock API
✅ Unit testing, API Mocks using Mockito
✅ Widget tests
✅ Support for 🌓 Dark/Light mode
✅ CI via Github Actions
✅ Tool to generate data transfer objects serialization/deserialization boiler plate code using json_serializable
- Install Flutter SDK here.
- Run
flutter doctor
in terminal and install all missing dependencies required by Flutter to run.
git clone [email protected]:bedrockio/bedrock-flutter.git <name_of_project>
Note: Project names should use underscores between words because flutter tool doesn't allow dashes/hyphens to be used in project name.
After cloning the project, use your terminal to go into the root folder and execute the following command: flutter pub get
. After this, go into the ios
folder, and execute pod install
.
This will download the dependencies needed to succesfully build and run the sample project.
This project is a starting point for a Flutter application that follows the simple app state management tutorial.
For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.
When adding new data transfer objects (check product_model.dart) generate the boiler plate code by running
flutter pub run build_runner build
- (In case there's conflicts run)
flutter packages pub run build_runner build --delete-conflicting-outputs
When running the app in debug-mode or on UAT, a [DEBUG] menu will be available. Through this screen various debug features are available.
By default, all error requests and responses will be logged when running the app in debug mode. Additionally, you can turn on logging for all requests that will be accessible within the Debug screen.
Add any screens you want quick access to under the 'screens' section.
From the Debug screen, you can toggle between UAT and PROD environments. The override will be saved throughout the lifespan of your session. When you log out, the app will reset to its original state.
Bedrock Flutter uses a StreamController to globally handle error messages. To display a visual error message, use ErrorHelper.broadcastError(e)
in lieu of the usual emit(StateError())
. This will then be intercepted in MainScreen to display an error dialog.
For custom error handling, continue to emit error states either instead of, or in addition to the ErrorHelper broadcaster.
UAT: flutter run --flavor runner_uat -t lib/src/env/main_uat.dart
PROD: flutter run --flavor runner_prod -t lib/src/env/main_prod.dart
UAT: flutter run --flavor runner_uat -t lib/src/env/main_uat.dart
PROD: flutter run --flavor runner_prod -t lib/src/env/main_prod.dart
UAT: flutter build apk --flavor runner_uat -t lib/src/env/main_uat.dart
PROD: flutter build apk --flavor runner_prod -t lib/src/env/main_prod.dart
UAT: flutter build ios --flavor runner_uat -t lib/src/env/main_uat.dart
PROD: flutter build ios --flavor runner_prod -t lib/src/env/main_prod.dart