Skip to content

isabella232/dart-basics

 
 

Dart Basics

This repository contains a collection of useful extension methods on the built-in objects in Dart, such as String, Iterable, and Object.

⚠️ Due to the ongoing null safety migration in the Dart SDK, the code currently available in the basics pub package does not reflect the state of the code in this repo. The code in this repo has been updated to be null-aware, which requires an SDK feature still gated by an experiment flag. Until the latest stable release of the Dart SDK includes null safety by default, the basics pub package will not be updated with any changes from this repo.

Usage

Import the basics library.

import 'package:basics/basics.dart';

Then use the methods directly on objects in your dart code.

List<int> numbers;

if (numbers.isNull) {
  print('Numbers is uninitialized');
}

for (var i in 1.to(10)) {
  if (i.isEven) numbers.add(i);
}

if (numbers.isNotNull && numbers.all(isEven)) {
  print('All numbers are even');
}

Notes

This is not an official Google project.

About

A Dart library containing convenient extension methods on basic Dart objects.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 100.0%