maybe_as 0.0.6 copy "maybe_as: ^0.0.6" to clipboard
maybe_as: ^0.0.6 copied to clipboard

Optional as. Returns null if type if not match the class type.

example/main.dart

import 'package:maybe_as/maybe_as.dart';

void main() {
  dynamic object;
  object = 1;
  print((object as Object).maybeAs<String>());
  object = "string";
  print(object.maybeAs<int>());
  print("1,2,3".maybeAsOr<String>("").split(","));
  print(1.maybeAsOr<String>("").split(","));
}
5
likes
140
pub points
28%
popularity

Publisher

verified publisherpub.iostech.org

Optional as. Returns null if type if not match the class type.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-2-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on maybe_as