toNullable method

NullableKind<T> toNullable()

Returns a nullable version of this kind.

There are two cases:

  • If this kind is already nullable, returns this kind.
  • Otherwise constructs Nullable<T>(this).

Examples

import 'package:kind/kind.dart';

void main() {
  StringKind().toNullable(); // --> NullableKind(StringKind())
  NullableKind(StringKind()).toNullable(); // --> NullableKind(StringKind())
}

Implementation

NullableKind<T> toNullable() => NullableKind<T>(this);