m8ty_client_common
Package overview
Section titled “Package overview”m8ty_client_common solves this by centralizing shared immutable models, serialization, and header configuration, giving all m8ty client integrations a consistent foundation.
Shared models, serializers, and header/interceptor configuration used across all m8ty client packages.
Before you start
Section titled “Before you start”Check the documentation of the m8ty_client_common library to get an idea about the available models and their properties.
Import all needed libraries
Section titled “Import all needed libraries” import 'package:dio/dio.dart'; import 'package:m8ty_client_common/m8ty_client_common.dart'; import 'package:built_collection/built_collection.dart';Key Capabilities
Section titled “Key Capabilities”- Shared
built_valuemodels (status, error, paging, trends, currencies, addresses) - Shared serializers and date handling via
standardSerializers - Shared request headers through
M8tyHeadersInterceptor - API key auth constant
m8tyApiKeyAuth/X-M8TY-API-KEY
Configure Dio with shared headers
Section titled “Configure Dio with shared headers”Dio buildConfiguredDio({ required String deviceId, required String userAgent,}) { final dio = Dio();
dio.interceptors.add( M8tyHeadersInterceptor( deviceId: deviceId, userAgent: userAgent, ), );
return dio;}How to perform different tasks
Section titled “How to perform different tasks”Here some examples how the dart client can be used
Create amount model
Section titled “Create amount model” ModelHelperCommon().createAmount( value: 10.20, currency: IsoCurrencyEnumModel.CHF, );Create amount model from string
Section titled “Create amount model from string” ModelHelperCommon().createAmount( value: 10.20, currency: IsoCurrencyEnumModel.valueOf("CHF"), );© m8ty GmbH 2023 · m8ty.eu
