time_span 1.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 80

A Dart library that parses two time strings of format HH:MM and calculates the time span in minutes as int or hours as double.

Usage #

A simple usage example:

import 'package:time_span/time_span.dart';

void main() {
  var timeSpan = TimeSpan('09:00', '21:30');
  print('Time span in hours: ${timeSpan.inHours}'); // 12.5
  print('Time span in inMinutes: ${timeSpan.inMinutes}'); // 750
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

1.0.3 (2020-01-25) #

  • fix typo in pubspec.yaml description
  • update README.md

1.0.2 (2020-01-23) #

  • fix pubspec.yaml

1.0.1 (2020-01-23) #

  • fix pubspec.yaml

1.0.0 (2020-01-23) #

  • add TimeSpan.inHours which returns a double value representing the amount of hours and minutes of a time span.
  • Add TimeSpan.inMinutes which returns an integer value representing the amount of minutes of a time span.

example/time_span_example.dart

import 'package:time_span/time_span.dart';

void main() {
  var timeSpan = TimeSpan('09:00', '21:00');
  print('Time span in hours: ${timeSpan.inHours}'); // 12
  print('Time span in inMinutes: ${timeSpan.inMinutes}'); // 720
}

Use this package as a library

1. Depend on it

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


dependencies:
  time_span: ^1.0.3

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

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

  • Dart: 2.8.4
  • pana: 0.13.14

Health issues and suggestions

Document public APIs. (-1 points)

11 out of 11 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/src/time_span_base.dart.

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

Format lib/time_span.dart.

Run dartfmt to format lib/time_span.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
time_parser ^1.1.0 1.1.0
Dev dependencies
pedantic ^1.9.0
test ^1.6.0