super_time 0.0.2+4 copy "super_time: ^0.0.2+4" to clipboard
super_time: ^0.0.2+4 copied to clipboard

The ultimate solution for simplifying time management in Dart and Flutter. Handle time-related tasks with intuitive APIs for time representation and formatting.

Super Time Flutter Package #

Work fast and efficiently with time in Dart.

Installation #

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

dependencies:
  super_time: <latest>

or

dart pub add super_time

Usage #

import 'package:super_time/super_time.dart';

Features #

Date Extensions #

st_toFr({bool withTime = false, bool withDay = true})

Converts the DateTime object to a French-formatted string.

DateTime.now().st_toFr(); // Output: "31 décembre 2023"

st_toEn({bool withTime = false, bool withDay = true})

Converts the DateTime object to an English-formatted string.

DateTime.now().st_toEn(); // Output: "December 31, 2023"

st_toFormat(String format)

Formats the DateTime object according to the provided format string.

DateTime.now().st_toFormat("dd/MM/yyyy"); // Output: "31/12/2023"

st_timeAgo()

Generates a human-readable time ago representation.

DateTime.now().subtract(Duration(minutes: 30)).st_timeAgo(); // Output: "30 minutes ago"

st_toTimestamp()

Converts the DateTime object to a timestamp string.

DateTime.now().st_toTimestamp(); // Output: "20231231120000"

st_toJson()

Converts the DateTime object to a JSON representation.

DateTime.now().st_toJson(); // Output: {"year": 2023, "month": 12, "day": 31, "hour": 12, "mi// nute": 0, "second": 0}

Overloaded Operators #

DateTime newDate = DateTime.now() + Duration(days: 7); // Adds 7 days to the current date
DateTime pastDate = DateTime.now() - 3.st_hours; // Subtracts 3 hours from the current date

Integer Extensions #

st_seconds, st_minutes, st_hours, st_days

Converts the integer to a Duration representing seconds, minutes, hours, or days, respectively.

int seconds = 120;
Duration duration = seconds.st_seconds; // Output: Duration(seconds: 120)
5
likes
140
pub points
8%
popularity

Publisher

unverified uploader

The ultimate solution for simplifying time management in Dart and Flutter. Handle time-related tasks with intuitive APIs for time representation and formatting.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on super_time