guard 1.0.4 guard: ^1.0.4 copied to clipboard
Evauluates the function wrapping the body with try/catch and returns default value if error was raised or return value is null
Use this package as a library
Depend on it
Run this command:
With Dart:
$ dart pub add guard
This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get
):
dependencies:
guard: ^1.0.4
Alternatively, your editor might support dart pub get
. Check the docs for your editor to learn more.
Import it
Now in your Dart code, you can use:
import 'package:guard/guard.dart';