License Dart Docs Flutter CI

velix

Introduction

Velix is Dart/Flutter library implementing some of the core parts required in every Flutter application:

  • type meta data
  • specification and validation of type constraints
  • general purpose mapping framework
  • json mapper
  • model-based two-way form data-binding
  • i18n
  • dependency injection container
  • command pattern for ui actions

Check out some articles on Medium:

The core - which is the capturing of type meta-data - is part of this package. The other packages are:

Overview

Validation

As in some popular Typescript libraries like yup, it is possible to declare type constraints with a simple fluent language

var type = IntType().greaterThan(0).lessThan(100);

type.validate(-1); // meeeh....will throw

Type Meta-Data

In combination with a custom code generator, classes decorated with specific annotations - here @Dataclass- emit the meta data:

@Dataclass()
class Money {
  // instance data

  @Attribute(type: "length 7")
  final String currency;
  @Attribute(type: ">= 0")
  final int value;

  const Money({required this.currency, required this.value});
}

The information will be used by a number of mechanisms, such as

  • dependency injection container
  • the mapping framework
  • form data-binding.

Installation

All packages are published to pub.dev.

Documentation

Detailed information can be found in the corresponding Wiki.