dart_extensions_methods 1.0.5

  • Readme
  • Changelog
  • Installing
  • 72

dart_extensions #

Extensions for different types similar to kotlin

Available classes and their usage #

Added class Pair like in other languages

Pair<int, String> pair = Pair();

Available method and their usage #

listOf - To create list from Iterable repeat - Executes the given function action specified number of times.
run - Calls the specified function operation with this value as its receiver and returns its result.
let - Calls the specified function operation with this value as its argument and returns its result.
also - Calls the specified function operation with this value as its argument and returns this value.

String extensions #

isNullOrEmpty - Returns true if this nullable char sequence is either null or empty.
isNotNullOrEmpty - Returns false if this nullable char sequence is either null or empty.
reversed - Returns a progression that goes over the same range in the opposite direction with the same step.
toInt - Returns the value of this number as an int.
toIntOrNull - Returns the value of this number as an int or null if can not be parsed.
toDouble - Returns the value of this number as an double.
toDoubleOrNull - Returns the value of this number as an double or null if can not be parsed.
toBoolean - Returns true if 'this' is "true", otherwise - false.
replaceAfter - Replaces part of string after the first occurrence of given delimiter with the replacement string.
replaceBefore - Replaces part of string before the first occurrence of given delimiter with the replacement string.
anyChar - Returns true if at least one element matches the given predicate.
containsIgnoreCase - Returns true if string contains another without matching case.

Bool extension #

not - Returns the inverse of this boolean.
and - Logical and.
or - Logical or.
xor - Logical xor.

Iterable extensions #

isNullOrEmpty - Returns true if this nullable iterable is either null or empty.
isNotNullOrEmpty - Returns false if this nullable iterable is either null or empty.
any - Returns true if at least one element matches the given predicate.
toSet - Convert iterable to set.
intersect - Returns a set containing all elements that are contained by both this set and the specified collection.
subtract - Returns a set containing all elements that are contained by this collection and not contained by the specified collection.
union - Returns a set containing all distinct elements from both collections.
countWhere - Returns count of elements that matches the given predicate.

List extensions #

distinctBy - Returns a list containing only elements from the given collection having distinct keys returned by the given selector function.

[0.0.1] - 13.02.2020 #

  • Basic extensions similar to kotlin.

[1.0.0] - 15.02.2020 #

  • Added some methods for String, Iterable, bool

[1.0.3] - 15.02.2020 #

  • Improved documentation

[1.0.4] - 11.03.2020 #

  • Added countWhere for Iterable and containsIgnoreCase for String

[1.0.5] - 11.03.2020 #

  • Improved documentation

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  dart_extensions_methods: ^1.0.5

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:dart_extensions_methods/dart_extensions_methods.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
49
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
72
Learn more about scoring.

We analyzed this package on Apr 6, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and dart_extensions_methods.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test