instant 0.3.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 84

Instant #

A library for manipulating and formatting DateTimes in Dart. Dates and times have never been easier.

  • | DateTime timezone manipulation
  • | Easy formatting
  • | Current time/date displays
  • | Manual time/date displays
  • | Customizable and modular
  • | A more sane stopwatch alternative

Instant is streamlined and easy to learn for beginners and experienced coders alike. To get started, visit:

0.3.1-0.3.2 (BREAKING) #

  • Added new methods
  • Made a unified difference method
    • Deleted the individual methods for differences
    • Accounts for time-based anomalies
  • Adjusted for Pub linting
  • Bugfixes for InstantStopwatch
  • Changed no-parameter methods to getters

0.2.1 #

  • Added new Stopwatch class
  • Added new timezone conversion methods

0.1.1 - 0.1.1+2 #

  • Created library with some formatting utilities
  • Added timezone conversion utilities
  • Made extensive docs on Gitbook and linked
  • Added issues, gitbook, github, and full author name to pubspec
  • Amended FormatTimeNow to FormatCurTime for consistency

example/instant_example.dart

import 'dart:io';

import 'package:instant/instant.dart';

// ignore_for_file: omit_local_variable_types, prefer_single_quotes
// ignore_for_file: non_constant_identifier_names, directives_ordering
// ignore_for_file: prefer_typing_uninitialized_variables, camel_case_types
// ignore_for_file: annotate_overrides

main() {
  DateTime SanFran = curDateTimeByZone(zone: "PDT"); //current DateTime in PDT timezone
  print(formatTime(time: SanFran)); //prints current time in PDT
  print(formatDate(date: SanFran)); //prints current date in PDT

  InstantStopwatch watch = InstantStopwatch();
  watch.play();
  print(watch.stopwatchInSeconds);
  sleep(Duration(seconds: 2));
  print(watch.stopwatchInSeconds);
  watch.pause();
  sleep(Duration(seconds: 2));
  print(watch.stopwatchInSeconds);
  watch.play();
  sleep(Duration(seconds: 2));
  print(watch.stopwatchInSeconds);

  // This is largely a placeholder with the most barebones of usage. Check the
  // Gitbook and API docs for a much more thorough set of guides and examples.
}

Use this package as a library

1. Depend on it

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


dependencies:
  instant: ^0.3.2

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:instant/instant.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
68
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
84
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.5

Health suggestions

Format lib/instant.dart.

Run dartfmt to format lib/instant.dart.

Format lib/src/date.dart.

Run dartfmt to format lib/src/date.dart.

Format lib/src/dtgeneral.dart.

Run dartfmt to format lib/src/dtgeneral.dart.

Format lib/src/time.dart.

Run dartfmt to format lib/src/time.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
meta ^1.1.7 1.1.8
Dev dependencies
pedantic ^1.8.0
test ^1.6.0