motocode_core 1.1.5
motocode_core: ^1.1.5 copied to clipboard
Motocode is a QR Code system for tracking spare parts and motorcycle products. It improves inventory accuracy and operational efficiency by enabling real-time tracking and reducing manual data entry.
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
setupMotocodeLocatorin themain.dartfile.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/loginPOST api/v2/login
- BusinessUnitsService
GET api/business-unitsGET api/business-units/{id}POST api/business-unitsPUT api/business-units
- DepartmentsService
GET api/departmentsGET api/departments/{id}POST api/departmentsPUT api/departments
- DepotTypesService
GET api/depot-typesGET api/depot-types/{id}GET api/depot-types/{id}/depotsPOST api/depot-typesPUT api/depot-types
- DepotsService
GET api/depotsGET api/depots/{id}POST api/depotsPUT api/depots
- EnrollmentsService
GET api/enrollments
- PositionsService
GET api/positionsGET api/positions/{id}POST api/positionsPUT api/positions
- QrCodesService
GET api/qr-codesPOST api/qr-codesGET api/qr-codes/{id}PUT api/qr-codes/{id}GET api/qr-codes/{id}/scanned-qr-codes
- RolesService
GET api/rolesGET api/roles/{id}POST api/rolesPUT api/roles
- ScannedQrCodesService
GET api/scanned-qr-codesPOST api/scanned-qr-codesGET api/scanned-qr-codes/{id}
- StatusesService
GET api/statusesPOST api/statusesGET api/statuses/{id}PUT api/statuses/{id}GET api/statuses/{id}/scanned-qr-codesGET 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