update: all test passing for reflection package
This commit is contained in:
parent
380bbdb517
commit
c13657e88c
1 changed files with 6 additions and 4 deletions
|
@ -8,12 +8,13 @@ class TestClass {
|
||||||
List<String> tags;
|
List<String> tags;
|
||||||
static const version = '1.0.0';
|
static const version = '1.0.0';
|
||||||
|
|
||||||
TestClass(this.name, {required this.id, this.tags = const []});
|
TestClass(this.name, {required this.id, List<String>? tags})
|
||||||
|
: tags = List<String>.from(tags ?? []); // Make sure tags is mutable
|
||||||
|
|
||||||
TestClass.guest()
|
TestClass.guest()
|
||||||
: name = 'Guest',
|
: name = 'Guest',
|
||||||
id = 0,
|
id = 0,
|
||||||
tags = const [];
|
tags = []; // Initialize with empty mutable list
|
||||||
|
|
||||||
void addTag(String tag) {
|
void addTag(String tag) {
|
||||||
tags.add(tag);
|
tags.add(tag);
|
||||||
|
@ -33,7 +34,8 @@ class GenericTestClass<T> {
|
||||||
T value;
|
T value;
|
||||||
List<T> items;
|
List<T> items;
|
||||||
|
|
||||||
GenericTestClass(this.value, {this.items = const []});
|
GenericTestClass(this.value, {List<T>? items})
|
||||||
|
: items = List<T>.from(items ?? []); // Make sure items is mutable
|
||||||
|
|
||||||
void addItem(T item) {
|
void addItem(T item) {
|
||||||
items.add(item);
|
items.add(item);
|
||||||
|
@ -242,7 +244,7 @@ void main() {
|
||||||
isRequired: [true, true, false],
|
isRequired: [true, true, false],
|
||||||
isNamed: [false, true, true],
|
isNamed: [false, true, true],
|
||||||
creator: (String name, {required int id, List<String>? tags}) =>
|
creator: (String name, {required int id, List<String>? tags}) =>
|
||||||
TestClass(name, id: id, tags: tags ?? const []),
|
TestClass(name, id: id, tags: tags),
|
||||||
);
|
);
|
||||||
Reflector.registerConstructor(
|
Reflector.registerConstructor(
|
||||||
TestClass,
|
TestClass,
|
||||||
|
|
Loading…
Reference in a new issue