Skip to content

Commit 5f031ab

Browse files
Add test cases for iOS
1 parent c6705a3 commit 5f031ab

File tree

2 files changed

+365
-131
lines changed

2 files changed

+365
-131
lines changed

lib/src/utils/utils.dart

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,17 @@ class Utils {
3333
OptimizelySegmentOption.resetCache: "resetCache",
3434
};
3535

36-
static Map<String, dynamic> convertToTypedMap(Map<String, dynamic> map) {
36+
/// Converts a map to platform-specific typed format
37+
///
38+
/// On iOS, returns a typed map with type information for proper native conversion.
39+
/// On Android, returns the original primitive map.
40+
///
41+
/// The [forceIOSFormat] parameter is used for testing purposes only to test
42+
/// iOS format conversion without running on actual iOS platform.
43+
static Map<String, dynamic> convertToTypedMap(
44+
Map<String, dynamic> map, {
45+
bool forceIOSFormat = false,
46+
}) {
3747
if (map.isEmpty) {
3848
return map;
3949
}
@@ -50,7 +60,7 @@ class Utils {
5060
}
5161
}
5262

53-
if (Platform.isIOS) {
63+
if (Platform.isIOS || forceIOSFormat) {
5464
return typedMap;
5565
}
5666
return primitiveMap;

0 commit comments

Comments
 (0)