Skip to content

cyrilcolinet/flutter-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌱 Flutter Sample Seed

Table of content

1. Requirements

Flutter and their tools versions

To run properly the mobile app you need to have (at least) the following flutter version.

⚠️ If the latest version is less than this version, try to change the flutter channel from stable to master.

Flutter 2.2.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision d79295af24 (il y a 4 semaines) • 2021-06-11 08:56:01 -0700
Engine • revision 91c9fc8fe0
Tools • Dart 2.13.3

Install packages dependencies

Before continue, you need to install all project dependencies:

flutter pub get

Generate freezed and json_serializable files

To add missing files in the project, you need to generate these files with the following command:

flutter packages pub run build_runner --delete-conflicting-outputs

2. Development guidelines

2.1. Architecture

This project has been build around Domain Driven Design (DDD) concept. It means all developments are made around the Domain. To ensure right implementation of the concept, this project uses Hexagonal architecture (Clean architecture) and Get X pattern.

Code has been split in 4 layers:

  • Domain
  • Application
  • Infrastructure
  • User interface

IMPORTANT Interactions:

  • Presentation can only access Application
  • Application can only access Domain
  • Infrastructure can only access Domain
  • Domain never access any other layer

2.2 Presentation

This is the stuff you're used to from "unclean" Flutter architecture. You obviously need widgets to display something on the screen. These widgets then dispatch events to the Bloc and listen for states.

2.3 Application

To write or read data from a User Interface (UI) (like REST or GraphQL Api) we cannot access to the Domain. This is why we use the Application layer. The aim of this layer is to interact with the Domain

2.4 Domain

Domain is the inner layer which shouldn't be susceptible to the whims of changing data sources or porting our app to Angular Dart. It will contain only the core business logic and business objects (entities). It must be totally independent of every other layer.

2.5 Infrastructure

he data layer consists of a Repository implementation (the contract comes from the domain layer) - one is usually for getting remote (API) data and the other for caching that data. Repository is where you decide if you return fresh or cached data, when to cache it and so on.

3. Production deploy

Before each build, do not forget to change the version of the application as well as the number of the build specified in pubspec.yml.

The build number must be incremented by 1 on each deployment and MUST NOT start again at 0 or be decremented, after which future builds on the Android side will not be validated.

3.1 IOS

3.1.1 Build

The next step will be to start the build with this command:

flutter build ios --release -t lib/main.prod.dart

3.1.2 Deploy

Once the build is finished (depending on the configuration, it can sometimes take more than ten minutes), it only remains to deploy on the awning with Fastlane.

First of all, make sure that these environment variables are your (and correct) ones in ios/fastlane/.env:

# Your Apple id
APPLE_ID=""

# Team ID
ITC_TEAM_ID="120643159"
APPLE_DEVELOPER_TEAM_ID="C6APZ87U2R"

To deploy the application in one of the two environments, go to the ios/ folder of the project and run one of the following commands:

# For production deployment
fastlane deploy_production

3.2 Android

Deployment on Android is much simpler than iOS because no specific configuration is needed.

3.2.1 Build

# For production environment
flutter build appbundle --release -t lib/main.prod.dart

3.2.2 Deploy

Once the build is finished (depending on the configuration, it can sometimes take more than ten minutes), it only remains to deploy on the awning with Fastlane.

First of all, make sure that these environment variables are your (and correct) ones in android/fastlane/.env:

# Path of the publish certificates (in json) needed to push application
JSON_KEY_PATH='yourLocalPath'

To deploy the application in one of the two environments, go to the android/ folder of the project and run one of the following commands:

# For production deployment
fastlane deploy_production_alpha

Once the deployment is complete, check on the Google Play Store platform the status of the build.

4. Git Guidelines

We have very precise rules over how our Git commit messages must be formatted. This format leads to easier to read commit history.

Each commit message consists of a header, a body, and a footer.

<header>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>

The header is mandatory and must conform to the Commit Message Header format. The body is optional for all commits except for those of scope "docs". When the body is required it must be at least 20 characters long. The footer is optional.

Any line of the commit message cannot be longer than 100 characters.

Commit Message Header

<type>(<scope>): <short summary>
│ │ │
│ │ └─⫸ Summary in present tense. Not capitalized. No period at the end.
│ │
│ └─⫸ Commit Scope: user|auth|animations...
│
└─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|test

The <type> and <summary> fields are mandatory, the (<scope>) field is optional.

Type

Must be one of the following:

  • build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
  • ci: Changes to our CI configuration files and scripts (example scopes: Circle, BrowserStack, SauceLabs)
  • docs: Documentation only changes
  • feat: A new feature
  • fix: A bug fix
  • perf: A code change that improves performance
  • refactor: A code change that neither fixes a bug nor adds a feature
  • test: Adding missing tests or correcting existing tests

About

🌱 Seed of all my flutter projects

Topics

Resources

License

Stars

Watchers

Forks