NotEmptyExtension<T extends String> extension

Extension on T? where T extends String to add a notEmpty method.

This extension provides a convenient way to handle nullable strings. The notEmpty method takes a function that is applied to the non-null and non-empty string.

The function should take a non-null T.

Example usage:

var nullableString = 'Hello';
nullableString.notEmpty((item) => print(item)); // prints: Hello
on
  • T?

Methods

notEmpty(VoidClosure value) → void

Available on T?, provided by the NotEmptyExtension extension