yanti 1.0.0
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
0
likes
100
pub points
4%
popularity

Yet Another Nullable Type Implementation

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

qqmikey@gmail.com

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on yanti