Motocode Core
A shared services to all motocode-related application
Features
- Setup Locator.
- List of models.
- List of services.
Getting started
There are two options to inject the services.
-
Call
setupMotocodeLocator
in themain.dart
file.void main() async { .... final baseUrl = 'URL_HERE' await setupMotocodeLocator(baseUrl, ); ... }
-
Inject the services by creating a custom locator. Create or update file
app.locator.custom.dart
.// Initialize Dio final dio = Dio( BaseOptions( connectTimeout: Duration(seconds: 10), responseType: ResponseType.json, ), )..interceptors.add( LogInterceptor( requestBody: true, responseBody: true, ), ); var baseUrl = '<BASE_URL_HERE>/api'; /// IMPORTANT: Register [ApiClient] first _locator.registerLazySingleton(() => ApiClient(dio, baseUrl: baseUrl)); // Register all the needed service only final apiClient = _locator<ApiClient>(); final crashlytics = FirebaseCrashlytics.instance; _locator.registerLazySingleton(() => BusinessUnitsService(apiClient, crashlytics)); _locator.registerLazySingleton(() => DepartmentsService(apiClient, crashlytics)); // Add other services here ...
Usage
Listing of available models or services.
List of usable Models
- Branch
- BusinessUnit
- Department
- DepotType
- Depot
- Position
- QrCode
- ScannedQrCode
- Status
- UserRole
- User
List of services
- ApiClient;
- AuthenticationService
POST api/login
POST api/v2/login
- BusinessUnitsService
GET api/business-units
GET api/business-units/{id}
POST api/business-units
PUT api/business-units
- DepartmentsService
GET api/departments
GET api/departments/{id}
POST api/departments
PUT api/departments
- DepotTypesService
GET api/depot-types
GET api/depot-types/{id}
GET api/depot-types/{id}/depots
POST api/depot-types
PUT api/depot-types
- DepotsService
GET api/depots
GET api/depots/{id}
POST api/depots
PUT api/depots
- EnrollmentsService
GET api/enrollments
- PositionsService
GET api/positions
GET api/positions/{id}
POST api/positions
PUT api/positions
- QrCodesService
GET api/qr-codes
POST api/qr-codes
GET api/qr-codes/{id}
PUT api/qr-codes/{id}
GET api/qr-codes/{id}/scanned-qr-codes
- RolesService
GET api/roles
GET api/roles/{id}
POST api/roles
PUT api/roles
- ScannedQrCodesService
GET api/scanned-qr-codes
POST api/scanned-qr-codes
GET api/scanned-qr-codes/{id}
- StatusesService
GET api/statuses
POST api/statuses
GET api/statuses/{id}
PUT api/statuses/{id}
GET api/statuses/{id}/scanned-qr-codes
GET api/statuses/{id}/qr-codes
- UsersService
GET api/users
- Get all the usersPOST api/users
- Create a userGET api/users/{id}
- Get specific userPUT api/users/{id}
- Update a userGET api/users/{id}/scanned-qr-codes
- Get all the scanned qr codes by userGET api/users/{id}/statuses
- Get a list of status of userGET api/users/{id}/depots
- Get a list of depots of userGET api/users/{id}/business-units
- Get a list of business unit of userGET api/users/{id}/departments
- Get a list of departments of the userGET api/users/{id}/positions
- Get a list of positions of the userGET api/users/{creatorId}/users
- Get all the users created by a creator
Libraries
- enums/enums
- locator/app_locator
- models/models
- models/src/base_command_response
- models/src/contracts_module
- models/src/enrolled_item
- models/src/location_module
- models/src/masterfile
- models/src/order_module
- models/src/paginated_response
- models/src/qr_code_module
- models/src/sticker_module
- models/src/tag_module
- models/src/user_module
- motocode_core
- services/services
- services/src/account_service
- services/src/api_client
- services/src/area_service
- services/src/authentication_service
- services/src/business_units_service
- services/src/departments_service
- services/src/depot_types_service
- services/src/depots_service
- services/src/enrollments_service
- services/src/orders_service
- services/src/positions_service
- services/src/qr_codes_service
- services/src/report_service
- services/src/roles_service
- services/src/scanned_qr_codes_service
- services/src/scanned_qrcode_tag_service
- services/src/statuses_service
- services/src/sticker_service
- services/src/users_service