Help Instance Help

m8ty_client_features

Features client to retrieve features configured on the server. Features are names of available features on the client which can be activated or deactivated on the server. Based on the configuration widgets should be rendered in the client or not. See therefore m8ty_feature_flags

Before you start

Check the documentation of the m8ty_client_features 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_features/m8ty_client_features.dart'; import 'package:m8ty_client_common/m8ty_client_common.dart'; import 'package:built_collection/built_collection.dart';

How to perform different tasks

Here some examples how the dart client can be used

Retrieve all configured features from server

final featuresClient = M8tyClientFeatures(); featuresClient.setApiKey(m8tyApiKeyAuth, "myApiKey"); final DefaultApi featuresApi = featuresClient.getDefaultApi(); final metadata = MetadataModel((final b) => b ..deviceId = "mydevice" ..userAgent = "Mozilla" ..buildNumber = "256" ..version = "1.2.1" ..userId = "myuser" ..packageName = "com.crealogix.mobilex.qa", ); final featuresRequestModel = FeaturesRequestModel((final b) => b ..name = "production" ..clientFeatures = MapBuilder({"featureA": true, "fatureB": false}) ..metadata = metadata.toBuilder()); }); final Response<BuiltMap<String, bool>> featureFlags = await featuresApi.getFeatures(featuresRequestModel: featuresRequestModel);
Last modified: 07 January 2025