From c13657e88cd680dcae7da84502512356dd5cb4f9 Mon Sep 17 00:00:00 2001 From: Patrick Stewart Date: Sat, 30 Nov 2024 08:05:27 -0700 Subject: [PATCH] update: all test passing for reflection package --- packages/reflection/test/scanner_test.dart | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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,