flutter_getx_boilerplate
during my study of flutter, i have been using the flutter_bloc state management framework. i accidentally saw the getx state management framework. through readme, i found that the getx framework is very easy to get started. so i want to write a getx starter project while learning, which can not only help myself learning can also help others quickly build a boilerplate. before building this boilerplate, i searched many similar projects, and found that they were relatively simple, and none of them covered the common things that the project should have, so i sprouted the idea of writing one by myself. let me introduce them one by one below.
technology & project introduction
use flutter 2.x to build a set of features containing predefined folder structure, style themes, api access, state management, routing & dependencies, etc. the project structure is clear and can be easily used as a flutter template project. technologies used include but are not limited to flutter, dart, getx, etc.
installation & use
step 1:
download this project to your own warehouse:
kevinzhang19870314/flutter_getx_boilerplate.git
step 2:
open the project folder with vs code and execute the following command to install the dependency package:
flutter pub get
step 3:
open the main.dart file in the lib folder, f5 or ctrl + f5 to run the project, and then you can start developing and debugging.
folder structure
the following is the project folder structure (only the folders under lib are introduced)
lib/
|- api - global restful api requests, including interceptors, etc.
|- interceptors - interceptors, including auth, request, and response interceptors.
|- api.dart - restful api export file.
|- lang - internationalization, including translation files, translation service files, etc.
|- lang.dart - language export file.
|- models - various structured entity classes, divided into request and response entities.
|- models.dart - entity class export file.
|- modules - business module folder.
|- auth - login & registration module.
|- home - home module.
|- splash - splash module.
|- modules.dart - module export file.
|- routes - routing module.
|- app_pages.dart - routing page configuration.
|- app_routes.dart - route names.
|- routes.dart - route export file.
|- shared - global shared folders, including static variables, global services, utils, global widgets, etc.
|- shared.dart - global shared export file.
|- theme - theme folder.
|- app_bindings.dart - services started before the app runs, such as restful api.
|- di.dart - global dependency injection objects, such as sharedpreferences, etc.
|- main.dart - main entry.
other
in the writing process, because it involves the call of restful api, here i used the free test api provided by req|res.
test user as below:
email: "[email protected]",
password: "pistol"
Comments are closed.