This is a starter template to build Flutter applications. It is heavily inspired by the learnings I made watching tutorials by FilledStacks and Reso Coder so you might say that it is an opinionated template. If you intend to use this template, I highly recommend you to go watch some of their tutorials so that you can really understand what this package provides.
This template covers the basic configuration needed to start any type of Flutter project, but it may be more suited for Android and IOS applications.
To use this template two options are available:
- The recommended option is to use the "Use this template" button to create a new repository from this one.
- You can also clone this repo locally and start from there.
This template comes with its fair share of useful dependencies and in order to use them, you must first run the command flutter pub get
.
Make sure that your dependencies are up to date by running flutter pub upgrade
and running flutter pub get
after.
You will probably want to change the package and bundle name to use a unique custom one. To do so, I invite you to follow the steps provided by this StackOverflow discussion: Change package name in Flutter or use the following package: change_app_ package_name.
This template uses the flutter_launcher_icons package to generate the icons. Here is the procedure to change the app icon:
- Replace the 4 images in the
assets/launcher
folder by your images. To learn more about the different proposes of the 4 images, I invite you to read the package's documentation. - Run the
flutter pub run flutter_launcher_icons:main
command.
Some lint rules are defined in the analysis_options.yaml
file by default. You can customize those rules to your liking. To learn more about the available rules, please refer to the lint package documentation.
By default the Device Preview package is not enabled. If you want to use it to see how your app would look on different devices, make sure to set the enabled
parameter to true
in the main`` function from the
main.dart``` file.
Everything is set to start your new project! You can now run your app and make sure that it is properly setup!
This template uses the navigation service provide with the stacked_services package. When creating a new page, you simply need to add it to the array in the app/app.dart
file and run the flutter pub run build_runner build --delete-conflicting-outputs
command to use the new route. To learn about how to use the service throughout the app, I invite you to read the package documentation.
This template use a custom injection container based on the stacked locator to simplify the use of services. The stacked_services package provides a way to automatically generate this type of locator, but a custom one is preferable to idealize the use of abstraction throughout the application.
To add a new service, you simply have to register it in the injection_container.dart
file.
flutter_launcher_icons: Command-line tool that make updating the app's launcher icon easy.
get_it: A service locator.
stacked: A MVVM architecture developed by the FilledStacks community.
stacked_services: A package that provides services to help with the implementation of the Stacked architecture.
stacked_hooks: A package that allows you to use the Flutter Hooks package with the Stacked architecture.
flutter_hooks: A Flutter implementation of React hooks.
equatable: Package that makes comparison between objects easier.
dartz: Functional programming in Dart.
internet_connection_checker: Check accurately the connection status of the devices.
lint: Community-driven collection of lint rules for Dart and Flutter.
mockito: Mock library for Dart.
device_preview: Package that approximate the looks of your app on any device from any device.