diff --git a/packages/reflection/test/scanner_test.dart b/packages/reflection/test/scanner_test.dart index fb08515..f1de0f6 100644 --- a/packages/reflection/test/scanner_test.dart +++ b/packages/reflection/test/scanner_test.dart @@ -8,12 +8,13 @@ class TestClass { List tags; static const version = '1.0.0'; - TestClass(this.name, {required this.id, this.tags = const []}); + TestClass(this.name, {required this.id, List? tags}) + : tags = List.from(tags ?? []); // Make sure tags is mutable TestClass.guest() : name = 'Guest', id = 0, - tags = const []; + tags = []; // Initialize with empty mutable list void addTag(String tag) { tags.add(tag); @@ -33,7 +34,8 @@ class GenericTestClass { T value; List items; - GenericTestClass(this.value, {this.items = const []}); + GenericTestClass(this.value, {List? items}) + : items = List.from(items ?? []); // Make sure items is mutable void addItem(T item) { items.add(item); @@ -242,7 +244,7 @@ void main() { isRequired: [true, true, false], isNamed: [false, true, true], creator: (String name, {required int id, List? tags}) => - TestClass(name, id: id, tags: tags ?? const []), + TestClass(name, id: id, tags: tags), ); Reflector.registerConstructor( TestClass,