A fast start flutter project to make aps faster and skip setup on every application. I am personally using this structure while creating a new project

Overview

Flutter Fast Start

Flutter fast start

A fast start flutter project to make apps faster and skip setup on every application. I am personally using this structure while creating a new project

Concept

  • MVMM Architecture
  • Feature-based foldering
  • Dependency Injected Services
  • Localization & Theme Support

Tech

Others
  • Flutter SVG
  • JSON Serializer
  • Lottie
  • Google Fonts
  • Url Launcher
  • Splash Screen
  • Onboarding Screen

Folder Structure

lib
├── const
│   ├── globals.dart
│   ├── project_paddings.dart
│   └── project_values.dart
├── core
│   ├── cache
│   │   ├── abstract
│   │   │   └── cache_repository.dart
│   │   ├── app_settings_model.dart
│   │   ├── app_settings_model.g.dart
│   │   └── isar_cache_repository.dart
│   ├── extensions
│   │   └── list_extension.dart
│   ├── injection
│   │   └── locator.dart
│   ├── l10n
│   │   ├── app_en.arb
│   │   └── app_tr.arb
│   ├── network
│   │   ├── abstract
│   │   │   └── networt_service.dart
│   │   ├── dio_network_service.dart
│   │   └── network_paths.dart
│   ├── routing
│   │   ├── abstract
│   │   │   └── router_service.dart
│   │   ├── auto_route.dart
│   │   ├── auto_route.gr.dart
│   │   ├── auto_route_service.dart
│   │   └── model
│   │       └── routes.dart
│   ├── theme
│   │   ├── project_colors.dart
│   │   └── project_theme.dart
│   └── utils
│       ├── helper_widgets
│       │   ├── apply_color.dart
│       │   ├── form_input_base.dart
│       │   └── paddings.dart
│       ├── regex_validators.dart
│       └── snackbar
│           ├── abstract
│           │   └── snackbar_service.dart
│           └── top_snackbar_service.dart
├── feature
│   ├── onboard
│   │   └── presentation
│   │       └── onboard_view.dart
│   └── splash
│       ├── presentation
│       │   └── splash_view.dart
│       └── service
│           └── init_service.dart
└── main.dart

Pre-prepared Services

Get_it and Locator Variable

I am using Get.it as a service locator package. All services and repositories which not require BuildContext or WidgetRef should be called from Get.it package. Also, all services are dependency injected. You can create your services & repositories and edit from lib/core/injection/locator.dart

You may think also think to make your dependency injections via Riverpod. I personally preferred to make a separation between the service locator and state packages.

Isar Service

Why Isar?

Simon Leiser (Producer of both Isar and Hive packages) stated Isar is the future of Hive on the Isar documentation. So I decided to use Isar in my projects.

Isar Service Repository and AppSettingsModel

My Isar service comes with AppSettingsModel which is useful for caching app settings (user token or theme mode etc.). In IsarRepository has getAppsettings() and putAppSettings() methods which return AppSettingsModel.

locator<CacheRepository>().getAppsettings();

locator<CacheRepository>().putAppsettings();

AppSettingsModel has a bool type predefined value of isFirstLaunch

AutoRoute Service

Auto Route service class has routing methods and also has Routes.dart class to store route names.

locator<RouterService>().pushNamed(Routes.onboard);

locator<RouterService>().pushNamedRemoveStack(Routes.home);

locator<RouterService>().pop();

locator<RouterService>().popUntil(Routes.home);

locator<RouterService>().popUntilRoot();

final route = locator<RouterService>().currentRouteName();

Auto Route Service not requires BuildContext but has some limitations.

From the AutoRoute documentation:

Note: navigating without context is not recommended in nested navigation unless you use navigate instead of push and you provide a full hierarchy. e.g router.navigate(SecondRoute(children: [SubChild2Route()]))

Dio Network Service

Network service consists of only one method that asks NetworkPaths class as a parameter. It pushes all the error messages automatically via the notification service.

If you have an API request you should insert your API endpoints to NetworkPaths class and use this: var data = locator<NetworkService>().execute(NetworkPaths.getUserById);

Snackbar Notification Service

Easy-to-use notification service without BuildContext requirement. It uses ScaffoldMessengerKey from globals.dart. To use:

locator<SnackbarService>().showSnackbar(
type: SnackBarType.error,
title: title,
message: message
);

Paddings

It provides an easy and standardized way to apply paddings. Also, it has useful ListView, Colum, and Row methods.

Measurements

Measurements can be changed from lib/const/project_paddings.dart

  • Small (.s) gives 8px of padding(s)
  • Medium (.m) gives 16px of padding(s)
  • Large (.l) gives 32px of padding(s)
  • XLarge (.xl) gives 64px of padding(s)

Every Padding widget has child property and named constructors as measurement

Example:

To give 8px of top padding

PaddingTop.s(child: Container());
Directions
  • PaddingAll
  • PaddingTop
  • PaddingRight
  • PaddingHorizontal
  • PaddingVertical
  • PaddingTopLeft
ListView, Column, and Row children spacing's

Paddings.dart has also some widgets which help gives padding to each child

  • ListViewWithSpacing ==> Gives padding between each child of ListView
  • ColumnWithSpacing ==> Gives padding between each child of Column
  • RowWithSpacing ==> Gives padding between each child of Row
Example:

To give 8px of top padding to each child of ListView

ListViewWithSpacing.s(
    children: [
        Center(), 
        Container()
    ]);

Other Services and Notes

  • ApplyColor widget changes all text colors of the child which uses theme style (Theme.of(context).textTheme...). It is mandatory to extract its child or use builder
  • TextFormFieldBase, PasswordFieldBase and MailFieldBase are form fields that provide some easy pre-defined methods like Regex validators, obscuring text, or comparing passwords.
  • OnBoard and Splash screens are defined as features. A splash screen is called initService and if the application launches for the first time, redirects to the OnBoard screen.

All Contributions are Welcome!

I am completely open to improvements and fixes. Please open an issue or make a pull request to contribute to this. Thanks in advance!

You might also like...

Wrapper for flutter_test that adds a tester argument to setUp and tearDown functions

flutter_test_ui Wrapper of testWidgets, setUp, and tearDown that provide the WidgetTesterCallback argument to the set-up and tear-down functions: test

Apr 10, 2022

An application built using Flutter that can be used while playing board games if actual or physical dice is missing . This is a dual dice application.

diceee_utter A new Flutter application. Getting Started This project is a starting point for a Flutter application. A few resources to get you started

Feb 3, 2022

A Flutter application that allows interacting with Pokemons, built using Clean Archtitecture structure and riverpod as state management.

A Flutter application that allows interacting with Pokemons, built using Clean Archtitecture structure and riverpod as state management.

pokedex Welcome to the Pokedex project! Getting Started Instructions to run: This project uses flutter version 3.0.3, Make sure you have that version

Nov 22, 2022

Tabbed sliverlist - A simple flutter plugin to setup sliverlist with TabBar with minimal code.

Tabbed sliverlist - A simple flutter plugin to setup sliverlist with TabBar with minimal code.

tabbed_sliverlist A package to simplify initialization of TabBar with ListView builder implemented using sliverappbar and sliverlist. Scroll position

Jan 3, 2022

Demo app with continuous integration setup for auto across android/iOS app stores

demo_flutter_ci A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started

Dec 25, 2021

Flutter Architecture Blueprints is a project that introduces MVVM architecture and project structure approaches to developing Flutter apps.

Flutter Architecture Blueprints is a project that introduces MVVM architecture and project structure approaches to developing Flutter apps.

Flutter Architecture Blueprints Flutter Architecture Blueprints is a project that introduces MVVM architecture and project structure approaches to dev

Apr 9, 2022

Flutter App Templete is a project that introduces an approach to architecture and project structure for developing Flutter apps.

Flutter App Template "Flutter App Template" is a project that introduces an approach to architecture and project structure for developing Flutter apps

Jan 5, 2023

Flutter Architecture Blueprints is a project that introduces MVVM architecture and project structure approaches to developing Flutter apps.

Flutter Architecture Blueprints is a project that introduces MVVM architecture and project structure approaches to developing Flutter apps.

Flutter Architecture Blueprints Flutter Architecture Blueprints is a project that introduces MVVM architecture and project structure approaches to dev

Dec 31, 2022
Owner
Okan Demir
Okan Demir
This is template toolkit fasten your project setup within a minute. The toolkit is based on MVC+S structure.

BWeird Flutter Toolkit! Hi! From a Weirder Flutter has been great on mobile development and I took this opportunity to make it even greater with templ

Setak Varaman !!!! 6 Aug 22, 2021
Pre-defined setup to start developing flutter project with stacked architecture.

un_official A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if t

Aashish Jha 0 Dec 27, 2021
Flutter kick start - Flutter Kick Start Project Pattern

Flutter Kick Start Project Pattern A new Flutter project where basically show a

Md. Sabik Alam Rahat 3 Apr 27, 2022
DostiPak - Dating app to make connection between people and start new love story to lovers

Dosti Pak Dating app to make connection between people and start new love story

ABDULKARIM ALBAIK 6 Oct 2, 2022
A package help you to make api call and handle error faster, also you can check for internet before call api.

http_solver ##not for production use, only for learning purpose. A package help you to make api call and handle error faster, also you can check for i

Abdelrahman Saed 1 Jun 18, 2020
The official open source app of the GSDCs of Benin. Feel free to contribute and make this app great for every members

GDSC-Events-Benin The official open source app of the GSDCs of Benin. Feel free to contribute and make this app great for every members ?? Contributor

Junior Medehou 2 Feb 4, 2022
This project demonstarates UI setup for some basic flutter widgets.

Flutter Widgets This project demonstarates UI setup for some basic flutter widgets. Container | | Text | | Button | | Textfield | | Column | | Row | |

Girisankar G 2 Nov 20, 2021
A comprehensive flutter/dart tutorial with setup instructions and learning exercises.

flutter-tutorial A comprehensive flutter/dart tutorial with setup instructions and learning exercises. Setup Folder: https://drive.google.com/drive/u/

Eduardo Piccin 1 Oct 21, 2022