dartlin

coverage report pipeline status
plugin version dependencies

Introduction

What it does

Dartlin is a helper library that provides readable methods with which you can write cleaner looking code.

  • It allows you to have more control over your code flow. By using the when method for example, to write switch-like expressions.
  • It provides methods to create data sets of certain types, for example the range method.

What does it not do

The main focus of the library is adding readable methods and readability tends to not equal performance optimization. So is the case for some of the provided methods in this library. The performance hits of these methods is very minimal, but most of them do rely on closures to work.

Common Usage

Control flow

The when method replaces the switch statement. And can be used to write expressions:

final result = when(place, {
  1: () => CompetitionPlace.first,
  2: () => CompetitionPlace.second,
  3: () => CompetitionPlace.third,
  [4,5]: () => CompetitionPlace.honourableMentions,
  orElse: () => CompetitionPlace.others
});

See the when docs for more information.

Libraries

control_flow
Adding control flow methods for writing more readable code.
dartlin
Dartlin is a helper library that provides readable methods with which you can write cleaner looking code.
ranges
Adding methods for data set generation.