guard 1.0.2 copy "guard: ^1.0.2" to clipboard
guard: ^1.0.2 copied to clipboard

discontinued
outdated

Evauluates the function wrapping the body with try/catch and returns default value if error was raised

example/lib/main.dart

import 'package:guard/guard.dart';

class User {
  final String name;

  User(this.name);
}

void main() {
  final items = [];
  guard(() => items.first, null); // null

  User user;

  guard(() => Text(user.name), Text('Loading...'));
}
7
likes
0
pub points
4%
popularity

Publisher

verified publisherlesnitsky.dev

Evauluates the function wrapping the body with try/catch and returns default value if error was raised

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on guard