Useful extensions functions to dart language.
https://pub.dev/packages/siberia
imports
import 'package:siberia/siberia.dart';
orEmpty
:
final String? value;
print(value.orEmpty);
toInt
:
final String value = "10";
final int intValue = value.toInt();
toIntOrNull
:
final String value = "X10";
final int? intNullableValue = value.tryToInt();
toDouble
:
final String value = "10";
final double doubleValue = value.toDouble();
toDoubleOrNull
:
final String value = "X10";
final double? doubleNullableValue = value.tryToDouble();
orZero
:
int? exampleInt;
double? exampleDouble;
print(exampleInt.orZero);
print(exampleDouble.orZero);
Made with contributors-img.