getNullableProperty<T> method

  1. @override
Property<T?> getNullableProperty<T>(
  1. String name,
  2. T converter(
    1. String s
    ),
  3. T? defaultValue(), {
  4. 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);
}