getNullableProperty<T> method
Property<T?>
getNullableProperty<
T>( - String name,
- T converter(
- String s
),
- T? defaultValue(), {
- bool isImmutable = true,
})
override
Implementation
@override
Property<T?> getNullableProperty<T>(
String name, T Function(String s) converter, T? Function() defaultValue,
{bool isImmutable = true}) {
var property = element[name];
if (property == null) {
return createNullableProperty<T>(defaultValue(), isImmutable);
}
if (property is String) {
return createNullableProperty<T>(converter(property), isImmutable);
}
if (property is bool && T == bool) {
return createNullableProperty<T>(property as T, isImmutable);
}
if (property is int && T == int) {
return createNullableProperty<T>(property as T, isImmutable);
}
if (property is double && T == double) {
return createNullableProperty<T>(property as T, isImmutable);
}
if (property is Map<String, dynamic>) {
var expression = property['expression'];
if (expression != null) {
return StringExpressionProperty<T?>(expression);
}
}
return createNullableProperty<T>(defaultValue(), isImmutable);
}