seconds 1.0.6

  • Readme
  • Changelog
  • Example
  • Installing
  • 62

seconds #

Simple functions to work with seconds.

Used for compact dateTime storage (e.g. in database, or JWT "iat" claim).

Getting Started #

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

[1.0.5] - Minor #

fixed dependency version

[1.0.4] - added datetime_utc_converter dependency #

now handles conversion to UTC timezone

[1.0.4] - Reversed function #

added dateTimeUTCFromSeconds

[1.0.2] - Minor #

package info maintaining

[1.0.0] - Initial release #


import 'package:seconds/seconds.dart';

void main() async {
  final DateTime now =;

  //Do not call a variable "secondsNowUTC" as
  //secondsNowUTC is a library getter, as shown below
  final int secondsNow = secondsFromDateTimeUTC(now);

  await Future.delayed(const Duration(seconds: 1));

  final int secondsNowUTCbyGetter = secondsNowUTC;

  assert(secondsNowUTCbyGetter - secondsNow >= 1);

Use this package as a library

1. Depend on it

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

  seconds: ^1.0.6

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or 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:seconds/seconds.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.6

Health issues and suggestions

Document public APIs. (-1 points)

5 out of 5 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/seconds.dart.

Run dartfmt to format lib/seconds.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
datetime_utc_converter ^1.0.1 1.0.3