motocode_core 0.1.1
motocode_core: ^0.1.1 copied to clipboard
Core package for Skygo Motocode project
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/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-codesGET api/qr-codes/{id}POST api/qr-codesPUT api/qr-codes
- RolesService
GET api/rolesGET api/roles/{id}POST api/rolesPUT api/roles
- ScannedQrCodesService
GET api/scanned-qr-codesGET api/scanned-qr-codes/{id}POST api/scanned-qr-codesPUT api/scanned-qr-codes
- StatusesService
GET api/statusesGET api/statuses/{id}GET api/statuses/{id}/scanned-qr-codesPOST api/statusesPUT api/statuses
- UsersService
GET api/usersGET api/users/{id}GET api/users/{id}/scanned-qr-codesGET api/users/{id}/statusesGET api/users/{id}/depotsGET api/users/{id}/business-unitsGET api/users/{id}/departmentsGET api/users/{id}/positionsPOST api/usersPUT api/users