safe_cast

Last updated:

0 purchases

safe_cast Image
safe_cast Images
Add to Cart

Description:

safe cast

DIG Dart Safe Cast #





Simple syntax
Reduces boillerplate

Usage #
import 'package:safe_cast/safe_cast.dart';

Fruit? fruit = Cast.asNullable<Fruit>(maybeFruit);
// or, if you need a fruit
Fruit fruit = SafeCast.as<Fruit>(maybeFruit, ifNull: () => availableFruit());
copied to clipboard
How effective it is #
It is better for chained operations..
CuttedFruit? cutted = maybeFruit is Fruit ? maybeFruit.cut(fruitCutter) : null;
// intead of
CuttedFruit? cutted = Cast.asNullable<Fruit>(maybeFruit)?.cut(fruitCutter);
copied to clipboard
License #
GNU Lesser General Public License version 3 (LGPL-3.0)

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.