UnwrappedExtension<T> extension

Extension on T? to add an unwrapped method.

This extension provides a convenient way to handle nullable types. The unwrapped method takes a function that is applied to the non-null value.

The function should take a non-null T.

Example usage:

var nullableInt = 1;
nullableInt.unwrapped((item) => print(item)); // prints: 1
on
  • T?

Methods

unwrapped(VoidClosure value) → void

Available on T?, provided by the UnwrappedExtension extension