m8ty_client_common
Shared models, serializers, and header/interceptor configuration used across all m8ty client packages.
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
import 'package:dio/dio.dart';
import 'package:m8ty_client_common/m8ty_client_common.dart';
import 'package:built_collection/built_collection.dart';
Key Capabilities
Shared
built_valuemodels (status, error, paging, trends, currencies, addresses)Shared serializers and date handling via
standardSerializersShared request headers through
M8tyHeadersInterceptorAPI key auth constant
m8tyApiKeyAuth/X-M8TY-API-KEY
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
Here some examples how the dart client can be used
Create amount model
ModelHelperCommon().createAmount(
value: 10.20,
currency: IsoCurrencyEnumModel.CHF,
);
Create amount model from string
ModelHelperCommon().createAmount(
value: 10.20,
currency: IsoCurrencyEnumModel.valueOf("CHF"),
);
03 June 2026