Flutter-template-riverpod-go_router-hive

Description πŸ“œ

This project follows a specific structure and template for Flutter app creation. It's based on a template that originally utilized a robust CLI, following a block architecture. However, I adapted it to use Riverpod, making significant modifications to align it with Riverpod's principles. Additionally, the template includes numerous predefined widgets, which I customize based on project requirements. I adhere to Andrea's "Feature-first" approach, with my own modifications. I don't rely on Riverpod code generation and instead heavily utilize StateNotifier over other notifiers. So, happy coding to me!

Folder Structure πŸ“

.
β”œβ”€β”€ .DS_Store
β”œβ”€β”€ .dart_tool
β”‚   β”œβ”€β”€ .DS_Store
β”‚   β”œβ”€β”€ dartpad
β”‚   β”œβ”€β”€ extension_discovery
β”‚   β”œβ”€β”€ flutter_build
β”‚   β”œβ”€β”€ flutter_gen
β”‚   β”œβ”€β”€ package_config.json
β”‚   β”œβ”€β”€ package_config_subset
β”‚   └── version
β”œβ”€β”€ .env
β”œβ”€β”€ .env-example.txt
β”œβ”€β”€ .flutter-plugins
β”œβ”€β”€ .flutter-plugins-dependencies
β”œβ”€β”€ .github
β”‚   β”œβ”€β”€ PULL_REQUEST_TEMPLATE.md
β”‚   β”œβ”€β”€ cspell.json
β”‚   β”œβ”€β”€ dependabot.yaml
β”‚   └── workflows
β”œβ”€β”€ .gitignore
β”œβ”€β”€ .vscode
β”‚   β”œβ”€β”€ extensions.json
β”‚   └── launch.json
β”œβ”€β”€ README.md
β”œβ”€β”€ analysis_options.yaml
β”œβ”€β”€ android
β”‚   β”œβ”€β”€ .DS_Store
β”‚   β”œβ”€β”€ .gitignore
β”‚   β”œβ”€β”€ .gradle
β”‚   β”œβ”€β”€ app
β”‚   β”œβ”€β”€ build.gradle
β”‚   β”œβ”€β”€ gradle
β”‚   β”œβ”€β”€ gradle.properties
β”‚   β”œβ”€β”€ gradlew
β”‚   β”œβ”€β”€ gradlew.bat
β”‚   β”œβ”€β”€ local.properties
β”‚   └── settings.gradle
β”œβ”€β”€ assets
β”œβ”€β”€ build
β”‚   β”œβ”€β”€ .DS_Store
β”‚   β”œβ”€β”€ .last_build_id
β”‚   β”œβ”€β”€ 38042a41806411273a1a36c629ba9713.cache.dill.track.dill
β”‚   β”œβ”€β”€ 39f4bf50ad275767c79aa66def67de4c
β”‚   β”œβ”€β”€ 8f66b8507f29113a13ef8e9654d2db8a
β”‚   β”œβ”€β”€ app
β”‚   β”œβ”€β”€ flutter_image_compress_common
β”‚   β”œβ”€β”€ flutter_plugin_android_lifecycle
β”‚   β”œβ”€β”€ fluttertoast
β”‚   β”œβ”€β”€ image_picker_android
β”‚   β”œβ”€β”€ location
β”‚   β”œβ”€β”€ path_provider_android
β”‚   β”œβ”€β”€ sqflite
β”‚   └── url_launcher_android
β”œβ”€β”€ coverage_badge.svg
β”œβ”€β”€ ios
β”‚   β”œβ”€β”€ .DS_Store
β”‚   β”œβ”€β”€ .gitignore
β”‚   β”œβ”€β”€ Flutter
β”‚   β”œβ”€β”€ Podfile
β”‚   β”œβ”€β”€ Runner
β”‚   β”œβ”€β”€ Runner.xcodeproj
β”‚   β”œβ”€β”€ Runner.xcworkspace
β”‚   └── RunnerTests
β”œβ”€β”€ l10n.yaml
β”œβ”€β”€ lib
β”‚   β”œβ”€β”€ .DS_Store
β”‚   β”œβ”€β”€ app
β”‚   β”œβ”€β”€ bootstrap.dart
β”‚   β”œβ”€β”€ core
β”‚   β”œβ”€β”€ features
β”‚   β”œβ”€β”€ l10n
β”‚   β”œβ”€β”€ main_development.dart
β”‚   β”œβ”€β”€ main_production.dart
β”‚   └── main_staging.dart
β”œβ”€β”€ packages
β”‚   β”œβ”€β”€ .DS_Store
β”‚   β”œβ”€β”€ app_ui
β”‚   └── app_utils
β”œβ”€β”€ pubspec.lock
β”œβ”€β”€ pubspec.yaml
β”œβ”€β”€ test
β”œβ”€β”€ web
β”‚   β”œβ”€β”€ favicon.png
β”‚   β”œβ”€β”€ icons
β”‚   β”œβ”€β”€ index.html
β”‚   └── manifest.json
└── windows
    β”œβ”€β”€ .DS_Store
    β”œβ”€β”€ .gitignore
    β”œβ”€β”€ CMakeLists.txt
    β”œβ”€β”€ flutter
    └── runner

Getting Started πŸš€

coverage

style: very good analysis

License: MIT

Generated by the Very Good CLI πŸ€–

A Very Good Project created by Very Good CLI.


This project contains 3 flavors:

  • development

  • staging

  • production

To run the desired flavor either use the launch configuration in VSCode/Android Studio or use the following commands:

# Development

$  flutter  run  --flavor  development  --target  lib/main_development.dart

  

# Staging

$  flutter  run  --flavor  staging  --target  lib/main_staging.dart

  

# Production

$  flutter  run  --flavor  production  --target  lib/main_production.dart

*this app works on iOS, Android, Web, and Windows.

Building-apk βš™οΈ

# Development

$  flutter build apk  --flavor  development  --target  lib/main_development.dart

  

# Staging

$  flutter build apk  --flavor  staging  --target  lib/main_staging.dart

  

# Production

$  flutter build apk  --flavor  production  --target  lib/main_production.dart

Running Tests πŸ§ͺ

To run all unit and widget tests use the following command:

$  flutter  test  --coverage  --test-randomize-ordering-seed  random

To view the generated coverage report you can use lcov.

# Generate Coverage Report

$  genhtml  coverage/lcov.info  -o  coverage/

  

# Open Coverage Report

$  open  coverage/index.html

Working with Translations 🌐

This project relies on flutter_localizations and follows the official internationalization guide for Flutter.

Adding Strings

  1. To add a new localizable string, open the app_en.arb file at lib/l10n/arb/app_en.arb.

{

"@@locale": "en",

"counterAppBarTitle": "Counter",

"@counterAppBarTitle": {

"description": "Text shown in the AppBar of the Counter Page"

}

}

  1. Then add a new key/value and description

{

"@@locale": "en",

"counterAppBarTitle": "Counter",

"@counterAppBarTitle": {

"description": "Text shown in the AppBar of the Counter Page"

},

"helloWorld": "Hello World",

"@helloWorld": {

"description": "Hello World Text"

}

}

  1. Use the new string
import  'package:your_project/l10n/l10n.dart';

  

@override

Widget  build(BuildContext context) {

final l10n = context.l10n;

return  Text(l10n.helloWorld);

}

Adding Supported Locales

Update the CFBundleLocalizations array in the Info.plist at ios/Runner/Info.plist to include the new locale.

...

  

<key>CFBundleLocalizations</key>

<array>

<string>en</string>

<string>es</string>

</array>

  

...

Adding Translations

  1. For each supported locale, add a new ARB file in lib/l10n/arb.

β”œβ”€β”€ l10n

β”‚ β”œβ”€β”€ arb

β”‚ β”‚ β”œβ”€β”€ app_en.arb

β”‚ β”‚ └── app_es.arb

  1. Add the translated strings to each .arb file:

app_en.arb


{

"@@locale": "en",

"counterAppBarTitle": "Counter",

"@counterAppBarTitle": {

"description": "Text shown in the AppBar of the Counter Page"

}

}

app_es.arb


{

"@@locale": "es",

"counterAppBarTitle": "Contador",

"@counterAppBarTitle": {

"description": "Texto mostrado en la AppBar de la pΓ‘gina del contador"

}

}

Generating Translations

To use the latest translations changes, you will need to generate them:

  1. Generate localizations for the current project:
flutter  gen-l10n  --arb-dir="lib/l10n/arb"

Alternatively, run flutter run and code generation will take place automatically.