toJson method
Implementation
Map<String, dynamic> toJson() {
// `defaultView` and `disableBranding` used to live on hyperParams, which the
// native SDKs overwrite wholesale, so neither ever arrived. The SDK reads
// both from the configuration object. Forward the old spellings there,
// without overriding an explicit setting.
final legacy = <String, Object?>{
// ignore: deprecated_member_use_from_same_package
'defaultView': hyperParams?.defaultView,
// ignore: deprecated_member_use_from_same_package
'disableBranding': hyperParams?.disableBranding,
}..removeWhere((_, value) => value == null);
var configurationJson = configuration?.toJson();
if (legacy.isNotEmpty) {
final json = configurationJson ?? <String, dynamic>{};
legacy.forEach((key, value) => json[key] ??= value);
configurationJson = json;
}
return {
'clientSecret': clientSecret,
'ephemeralKey': ephemeralKey,
'configuration': configurationJson,
'customParams': customParams,
'hyperParams': hyperParams?.toJson(),
};
}