nullx 0.1.0+1 copy "nullx: ^0.1.0+1" to clipboard
nullx: ^0.1.0+1 copied to clipboard

nullx is a Dart toolkit that enhances handling of nullable types, providing utilities for null-checking, navigating nullable structures, and robust error handling, for cleaner and more resilient code

example/nullx_example.dart

import 'package:nullx/nullx.dart';

void main() {
  // ignore: unnecessary_nullable_for_final_variable_declarations
  const String? nullableString = 'example';
  unwrapped(nullableString, (value) {});
  final List<String?> strings = [null, 'one', null, 'two', null];
  strings.map((s) => s.letNonNull((s) => s.length)).whereType<int>().toList();

  final List<String?> strs = [null, 'one', null, 'two', null];
  strs.where((element) => element != null).map((e) => e!).toList();

  strs.mapNonNull((s) => s.length).toList();
}
8
likes
0
pub points
52%
popularity

Publisher

verified publishershtanko.dev

nullx is a Dart toolkit that enhances handling of nullable types, providing utilities for null-checking, navigating nullable structures, and robust error handling, for cleaner and more resilient code

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on nullx