Make Crud Module
Generate Data Layer and Ui Layer after Generating Model from json This command works on generating @freezed Model, Data Sources, Repository and (create, update, list, view-details) Screensxflutter_cli make crud
Result:
CLI provides two options to create the Flutter application Layer-Based Architecture and Feature-Based ArchitectureLayer-Based Architecture:
- xflutter_cli_test_application
- android
- assets
- ios
- lib
- data
- data_sources
- local
- products
- remote
- products
- products_remote_data_source.g.dart
- models
- entities
- product
- product.freezed.dart
- product.g.dart
- local
- product
- repositories
- products
- mediators
- paging
- router
- ui
- screens
- products
- create_product
- mobile
- viewmodels
- widgets
- products_list
- mobile
- viewmodels
- widgets
- update_product
- mobile
- viewmodels
- widgets
- view_product_details
- mobile
- viewmodels
- widgets
- widgets
Feature-Based Architecture:
- xflutter_cli_modules_application
- android
- assets
- ios
- lib
- modules
- products
- data
- data_sources
- local
- products
- remote
- products
- products_remote_data_source.g.dart
- models
- entities
- product
- product.freezed.dart
- product.g.dart
- local
- product
- repositories
- products
- mediators
- paging
- presentation
- screens
- create_product
- mobile
- viewmodels
- widgets
- products_list
- mobile
- viewmodels
- widgets
- update_product
- mobile
- viewmodels
- widgets
- view_product_details
- mobile
- viewmodels
- widgets
- widgets
Usage:
Name | Type | Description | Allowed Values | Example |
---|---|---|---|---|
src | option | specify one of the modules to execute command in (monorepo workspace or standalone modular-app) | - | |
crud-types | option | crud screens and actions types
| create, update, view, list, delete | |
entity-path | option | json absolute file path in the disk, or http api end-point | - | |
entity-name | option | name of entity for generating the data layer | - | |
json-key | option | generate model from specific key, this option is helpful when your model is nested object in json | - | |
end-point | option | add custom end-point to APIs, by default the APIs endpoint is the same of entity-name | - | shop/products |
primary-key | option | specify local-database entity with name of primary property, default is `id` | - | |
local-database | flag | generate local database with remote data | - | |
authorization | option | add authorization to your http request headers, Api maybe require authorization for return success response, in this case you need this option | - | Bearer your_jwt_token |
add-entity-prefix | flag | add prefix to all entity nested entities, ex: [Product -> Rating] will be [Product -> ProductRating] | - | |
base-dir | option | generate all/some models in base common directory, used only with (modules-architecture) | - | dimensions,reviews |
source | option | import file from specific module, this is helpful when you have multiple files with same name and one of them should be imported in the generated file, so you need to tell CLI which one should be imported | - | filename.dart:my_app1 |
sources | option | import file from multiple modules, this is helpful when you have multiple files with same name and many of them of them should be imported in the generated file, so you need to tell CLI which files should be imported | - | models.dart:my_package1, models.dart:my_package2 |