extension 0.5.0 icon indicating copy to clipboard operation
extension: ^0.5.0 copied to clipboard

Package including lot helpers for easy developing on dart language

Logo

Package including lot helpers for easy developing on dart language.

Pub

Key FeaturesGetting Started

Key Features #

  • Small weight
  • Simple usage
  • Many entities

Getting Started #

Import

import 'package:extension/extension.dart';

String #

// Capitalize first letter
'test'.capitalizeFirstLetter(); // return Test

// Check is email
'user@example.com'.isEmail; // return true
'qwerty'.isEmail; // return false

// Pluralize and singularize
pluralize(1, 'дом', 'дома', 'домов'); // returns дом
pluralize(2, 'дом', 'дома', 'домов'); // returns дома
pluralize(5, 'дом', 'дома', 'домов'); // returns домов

Date #

// Returns a [DateTime] with the date of the original
DateTime(2017, 3, 6, 12, 30, 15).dateOnly; // DateTime(2017, 3, 6)

// Is today
DateTime.now().isToday; // return bool

// Is yesterday
DateTime.now().isYesterday; // return bool

// Is yesterday
DateTime.now().isTomorrow; // return bool

/// The day after this [DateTime]
DateTime(2017, 3, 5).nextDay; // return DateTime(2017, 3, 6)

/// The day previous this [DateTime]
DateTime(2017, 3, 5).previousDay; // return DateTime(2017, 3, 4)

// First day of month
DateTime(2018, 9, 30).firstDayOfMonth; // returns DateTime(2018, 9, 1)

// Last day of month
DateTime(2017, 3).lastDayOfMonth; // DateTime(2017, 3, 31)

// All days in month, DateTime array
DateTime(2017, 3).daysInMonth; // [DateTime(2017, 3, 1), DateTime(2017, 3, 2), ...]

// Whether or not two times are on the same day.
DateTime.now().isSameDay(DateTime.now()); // returns true

// Whether or not two times are on the same week.
DateTime(2017, 3, 5).isSameWeek(DateTime(2017, 3, 6));

/// Tomorrow at same hour / minute / second than now
DateUtils.tomorrow;

/// Yesterday at same hour / minute / second than now
DateUtils.yesterday;

/// Current date (Same as [Date.now])
DateUtils.today;

// Returns a [DateTime] for each day the given range.
DateUtils.daysInRange(startDate, endDate); // List of dates

/// Other methods
date.firstDayOfWeek;
date.lastDayOfWeek;
date.previousMonth;
date.nextMonth;
date.previousWeek;
date.nextWeek;

And... all api reference available here

34
likes
130
pub points
91%
popularity

Publisher

verified publisher iconserge.software

Package including lot helpers for easy developing on dart language

Homepage

Documentation

API reference

License

Icon for licenses.MIT (LICENSE)

More

Packages that depend on extension