a template with best practices for starting a new app or becoming familiar with the architecture of our projects
Live Demo: https://patchaii.github.io/flutter_starter_project/
- VSCode (https://code.visualstudio.com/download).
- VSCode Extensions
- Flutter (https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter)
- Dart (https://marketplace.visualstudio.com/items?itemName=Dart-Code.dart-code)
- Bloc (https://marketplace.visualstudio.com/items?itemName=FelixAngelov.bloc)
- Flutter-Stylizer (https://marketplace.visualstudio.com/items?itemName=gmlewis-vscode.flutter-stylizer)
- Bracket Pair Colorizer 2 (https://marketplace.visualstudio.com/items?itemName=CoenraadS.bracket-pair-colorizer-2)
- Error Lens (https://marketplace.visualstudio.com/items?itemName=usernamehw.errorlens)
- Install (https://flutter.dev/docs/get-started/install).
to verify proper installation
flutter doctor -v
- add
dotenv
(filename: dotenv) file in the root of the project with:
ENDPOINT='https://graphql-pokemon2.vercel.app'
ENVIRONMENT='dev/prod/qa'
-
create a firebase project. info here: https://firebase.flutter.dev/docs/overview
-
add
GoogleService-Info.plist
in/ios/Runner/
: -
add
google-services.json
in/android/app/
:
https://pub.dev/packages/flutter_bloc
https://bloclibrary.dev/#/architecture
brew install lcov
flutter test
- coverage
flutter test --coverage
flutter test --coverage && lcov --remove coverage/lcov.info '**/*.freezed.dart' '**/*.g.dart' '**/*.graphql.dart' '**/*.part.dart' '**/*.config.dart' '**/*_event.dart' '**/*_state.dart' '**/*_repo.dart' '**/core/*' '**/*_controller.dart' '**/alert/*.dart' -o coverage/lcov.info && genhtml coverage/lcov.info --output=coverage && open coverage/index.html
- golden
flutter test --update-goldens
https://github.com/PatchAii/mago-merlino
- generate a new feature (bloc/repo/view) using the magic powers of mago merlino:
# install dart
brew install dart
# activate ✨mago_merlino✨
dart pub global activate -sgit https://github.com/PatchAii/mago-merlino.git
- then 🎶 listen to this: https://www.youtube.com/watch?v=Tb75RjpvBIk
# do some ✨magic✨
dart pub global run mago_merlino:mago_merlino create-feature --path lib/feature/abc
#or
dart pub global run mago_merlino:mago_merlino create-feature abc
Update transaltions:
make localisation
# Code generator "build_runner"
flutter pub run build_runner build
# Code generator "build_runner" with confict remove
flutter pub run build_runner build --delete-conflicting-outputs
Local and push notification are handled by Awesome_notification https://pub.dev/packages/awesome_notifications
To send a notification using FCM services, you need to send a POST to:
https://fcm.googleapis.com/fcm/send
To avoid misbehavior on Android and IOS you should send an empty notification field and use only data field for your data.
Here's an example of a POST request body:
{
"to" : "[YOUR APP FCM TOKEN]",
"mutable_content" : true,
"content_available": true,
"priority": "high",
"data" : {
"id": 100,
"channelKey": "basic_channel",
"title": "Basic message",
"body": "This is the body of a basic FCM message"
}
}
Inside headers define:
Content-type: application/json
Authorization: key=[server_key]