Skip to content

Commit 4f851bf

Browse files
committed
dynamic converters
1 parent 618c877 commit 4f851bf

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

modules/control_core/lib/core.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ part 'src/util/parser.dart';
4343
typedef InitFactory<T> = T Function(dynamic args);
4444
typedef ValueCallback<T> = void Function(T value);
4545

46-
typedef ValueConverter<T> = T Function(Object? value);
47-
typedef EntryConverter<T> = T Function(Object? key, Object? value);
46+
typedef ValueConverter<T> = T Function(dynamic value);
47+
typedef EntryConverter<T> = T Function(dynamic key, dynamic value);
4848

4949
typedef Predicate<T> = bool Function(T value);
5050

modules/control_core/test/parse_test.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ void main() {
102102
});
103103

104104
test('map', () {
105-
final parse1 = Parse.toMap<int, int>(list);
105+
final parse1 = Parse.toMap<int, int>(list, converter: (value) => value);
106106
final parse2 = Parse.toMap<dynamic, int>(list);
107107
final parse3 = Parse.toMap<dynamic, String>(list,
108108
converter: (item) => item.toString());
@@ -118,6 +118,7 @@ void main() {
118118
expect(parse1.length, 10);
119119
expect(parse2.length, 10);
120120
expect(parse3.length, 10);
121+
expect(parse1[0], 0);
121122
expect(parse3[0], '0');
122123

123124
expect(parse4.length, 10);

0 commit comments

Comments
 (0)