Skip to content

m8ty_client_common

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.

Check the documentation of the m8ty_client_common library to get an idea about the available models and their properties.

import 'package:dio/dio.dart';
import 'package:m8ty_client_common/m8ty_client_common.dart';
import 'package:built_collection/built_collection.dart';
  • Shared built_value models (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
Dio buildConfiguredDio({
required String deviceId,
required String userAgent,
}) {
final dio = Dio();
dio.interceptors.add(
M8tyHeadersInterceptor(
deviceId: deviceId,
userAgent: userAgent,
),
);
return dio;
}

Here some examples how the dart client can be used

ModelHelperCommon().createAmount(
value: 10.20,
currency: IsoCurrencyEnumModel.CHF,
);
ModelHelperCommon().createAmount(
value: 10.20,
currency: IsoCurrencyEnumModel.valueOf("CHF"),
);