yanti 1.0.0 copy "yanti: ^1.0.0" to clipboard
yanti: ^1.0.0 copied to clipboard

Yet Another Nullable Type Implementation

yanti #

Yet Another Nullable Type Implementation

Usage #

class TestClass {
  TestClass({this.value});

  String? value;

  TestClass copyWith({Optional<String>? value}) {
    return TestClass(
      value: value.or(this.value),
    );
  }
}
final foo = TestClass(value: 'foo');

final bar = foo.copyWith();
// value is 'foo'

final baz = foo.copyWith(value: Optional('bar'));
// value is 'bar'

final qux = foo.copyWith(value: Optional(null));
// value is null

final quux = foo.copyWith(value: Optional.empty());
// value is null
1
likes
110
pub points
3%
popularity

Publisher

unverified uploader

Yet Another Nullable Type Implementation

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on yanti