extendable 0.0.3+1

Flutter Android iOS web

A set of utilities for improve your code readability and development

extendable #

A set of utilities for improve your code readability and development.

style: effective dart Build

Topics #

Overview
Usage
Examples
Contributions

Overview #

The goal of this library is offer utilities that will improve our code readability and improve our productivity on our development.

Usage #

First import the library

import 'package:extendable/extendable.dart';

Now you can use all extensions available in this library!

Examples #

Let's suppose we need to compare if some object is null or not, we generally to this way

  String string;

  if (string  == null) {
    /// code
  }

  if (string  != null) {
    /// code
  }

But, how we can improve this? That's when the library comes to help.

  import 'package:extendable/extendable.dart';

  String string;

  if (string.isNull) {
    /// code
  }

  if (string.isNotNull) {
    /// code
  }

Much better, huh?

But, we offer some improvements on native functionalities of native libraries, for example the first method of a List. If we do this in a empty or null list:

  List list;
  List list2 = [];

  final first = list.first // NoSuchMethodError: The getter 'first' was called on null.

  final first2 = list2.first // Bad state: No element

With one of the functionalities on the ListUtil extension, you can do this way:

  import 'package:extendable/extendable.dart';
  
  List list;
  List list2;

  List list;

  final first = list.firstOrNull // Will get null

  final first2 = list2.firstOrNull // Will get null

Contributions #

Contributions are welcomed!

  • Add your method to a existing util or create a new one for different libraries.

  • Write tests for it.

  • Write documentation for it.

  • Make a pull request to the main branch

1
likes
100
pub points
20%
popularity

Publisher

lucaseduardo.dev

A set of utilities for improve your code readability and development

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

effective_dart, flutter

More

Packages that depend on extendable