MVVM stands for Model View View-model it provides the separation of development of the graphical user interface(GUI) from the business logic or back-end logic (or data model). The view model of MVVM is a converter that converts the data from the model in such a way that it can be managed and presented with great ease. So we could say that the view model is more model rather than a view as it handles most of the view's logic and it even makes the code very readable.
A boilerplate project created in flutter using MVVM (Following Google), BloC (flutter_bloc plugin), RxDart and others trending technical
The Boilerplate contains the minimal implementation required to create a new library or project. The repository code is preloaded with some basic components like basic app architecture, app theme, constants and required dependencies to create a new project. By using boiler plate code as standard initializer, we can have same patterns in all the projects that will inherit it. This will also help in reducing setup & development time by allowing you to use same code pattern and avoid re-writing from scratch.
Just Goooo:
Download or clone this repo by using the link below:
https://github.com/TC-ITECHVN/flutter_boilerplate.git
In-order to hide generated files, navigate to Android Studio
-> Preferences
-> Editor
-> File Types
and paste the below lines under ignore files and folders
section:
*.inject.summary;*.inject.dart;*.g.dart;
In Visual Studio Code, navigate to Preferences
-> Settings
and search for Files:Exclude
. Add the following patterns:
**/*.inject.summary
**/*.inject.dart
**/*.g.dart
- Splash
- Login
- Home
- Routing
- Theme
- Dio
- Database
- BloC pattern - using flutter_bloc (to connect the reactive data of your application with the UI)
- Provider (State Management)
- Encryption
- Validation
- Code Generation
- User Notifications
- Logging
- Dependency Injection
- Dark Theme Support (new)
- Multilingual Support (new)
- Provider example (new)
- // TODO
- // More TODO
- Dio
- Database
- BloC - flutter_bloc (to connect the reactive data of your application with the UI)
- Provider (State Management)
- Encryption
- Validation
- Logging
- Notifications
- Json Serialization
- Dependency Injection
This is the starting point of the application. All the application level configurations are defined in this file i.e, theme, routes, title, orientation etc.
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'constants/app_theme.dart';
import 'constants/strings.dart';
import 'ui/splash/splash.dart';
void main() {
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
DeviceOrientation.landscapeRight,
DeviceOrientation.landscapeLeft,
]).then((_) {
runApp(MyApp());
});
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: Strings.appName,
theme: themeData,
routes: Routes.routes,
home: SplashScreen(),
);
}
}
- // TODO LATER ...