octopus_extensions 2.2.14 copy "octopus_extensions: ^2.2.14" to clipboard
octopus_extensions: ^2.2.14 copied to clipboard

Pack of extensions and helters for day to day code boost

extensions #

extensions is a lightweight Dart package that extends core types like Duration, Iterable, String, Number, and DateTime with additional convenient methods.


Features #

  • Extended functionality for Duration, Iterable, String, Number, and DateTime.
  • Utility methods to simplify and clean your Dart code.
  • No external dependencies.

Getting started #

Add this to your pubspec.yaml:

dependencies:
  extensions: ^latest

Then run:

flutter pub get

or

dart pub get

Import it in your Dart code:

import 'package:octopusllc/extensions.dart';

Usage Examples #

Duration Extensions #

Duration duration = 5.minutes;
Duration combined = 2.hours + 30.minutes;

Iterable Extensions #

List<int> numbers = [1, 2, 3, 4];
int sum = numbers.sum;      // Returns 10
double average = numbers.average; // Returns 2.5

String Extensions #

String example = " Hello World ";
String trimmed = example.trimmed; // "Hello World"
bool isNumeric = "1234".isNumeric; // true
bool isEmail = "test@example.com".isValidEmail; // true

Number Extensions #

int value = 3;
bool isEven = value.isEven; // false

DateTime Extensions #

DateTime now = DateTime.now();
bool today = now.isToday;
bool tomorrow = now.isTomorrow;
bool yesterday = now.isYesterday;

DateTime startOfMonth = now.startOfMonth();
DateTime endOfMonth = now.getLastDayOfMonth;

DateTime corrected = now.intervalCorrection(15);

License #

This project is licensed under the MIT License.

0
likes
0
points
67
downloads

Publisher

verified publisheroctopus-apps.com

Weekly Downloads

Pack of extensions and helters for day to day code boost

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

intl

More

Packages that depend on octopus_extensions