time_ago_provider 1.0.3

time_ago_provider #

A Library that takes a time stamp value and returns an interval String of the time that passed between the given time stamp to the present. E.g.("7 minutes ago" ).

Usage #

Easy Lazy! Feed it timestamp, produces you time ago.

import 'package:time_ago_provider/time_ago_provider.dart';

void main()
{
  //Normal Usage
  //- Get the current time stamp
  int timeStamp = DateTime.now().millisecondsSinceEpoch;
  //- getTimeAgo(int timeStamp) returns a String " X minutes/hours/days/months/years ago ...
  String timeAgo = TimeAgo.getTimeAgo(timeStamp);
  print("Posted $timeAgo"); // Posted just now

  //With Language DEFAULT = English
  int germanTimeStamp = DateTime.now().millisecondsSinceEpoch;
  String germanTimeAgo = TimeAgo.getTimeAgo(germanTimeStamp, language: Language.GERMAN);
  print("Gepostet $germanTimeAgo");
}

Methods #

FunctionParameterDescriptionReturn
getTimeAgoint timeStampReturns an interval String of the time that passed between the given time stamp to the presentString timeAgo

Supported Languages #

  • [x] ENGLISH
  • [x] ARABIC
  • [x] GERMAN
  • [x] SPANISH
  • [x] CHINESE
  • [x] RUSSIAN
  • [x] PORTUGUESE
  • [x] JAPANESE
  • [x] HINDI
  • [x] FRENCH

Installing #

Package

Features and bugs #

If you face any problems feel free to open an issue at the issue tracker. If you feel the library is missing a feature, please raise a ticket on Github. Pull request are also welcome.

0.0.1 #

  • Initial version.

0.1.0 #

  • Stable version.

0.1.1 #

  • Code improved.

1.0.0 #

  • Method's Parameter (timeStamp) is now required.

1.0.1 #

  • Example Edited.

1.0.2 #

  • README.md Edited.

1.0.3 #

  • README.md Edited 1.

example/time_ago_provider_example.dart

import 'package:time_ago_provider/time_ago_provider.dart';

void main()
{
  //Normal Usage
  //- Get the current time stamp
  int timeStamp = DateTime.now().millisecondsSinceEpoch;
  //- getTimeAgo(int timeStamp) returns a String " X minutes/hours/days/months/years ago ...
  String timeAgo = TimeAgo.getTimeAgo(timeStamp);
  print("Posted $timeAgo"); // Posted just now

  //With Language DEFAULT = English
  int germanTimeStamp = DateTime.now().millisecondsSinceEpoch;
  String germanTimeAgo = TimeAgo.getTimeAgo(germanTimeStamp, language: Language.GERMAN);
  print("Gepostet $germanTimeAgo");
}

Use this package as a library

1. Depend on it

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


dependencies:
  time_ago_provider: ^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_ago_provider/time_ago_provider.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
67
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 Sep 10, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:time_ago_provider/time_ago_provider.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
Dev dependencies
pedantic ^1.0.0
test ^1.0.0