flunt_dart 0.4.0 copy "flunt_dart: ^0.4.0" to clipboard
flunt_dart: ^0.4.0 copied to clipboard

Library that provides a fluent way to use Notification Pattern.

example/example.dart

import 'package:flunt_dart/flunt_dart.dart';

class Customer {
  final String firstName;
  final String lastName;

  Customer(this.firstName, this.lastName);
}

class NameContract extends Contract<String> {
  NameContract(String value, String name) : super(value, name) {
    isNotEmpty("not should be empty");
    hasMaxLen(40, "should have no more than 40 chars");
    hasMinLen(3, "should have at least 3 chars");
  }
}

class CustomerContract extends Contract<Customer> {
  CustomerContract(Customer user) : super(user, "Customer") {
    addNotifiable(NameContract(user.firstName, "First Name"));
    addNotifiable(NameContract(user.firstName, "Last Name"));
  }
}
1
likes
40
pub points
0%
popularity

Publisher

unverified uploader

Library that provides a fluent way to use Notification Pattern.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

More

Packages that depend on flunt_dart