Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

Commit

Permalink
Migrate to Null safety
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrigorenko committed Mar 30, 2021
1 parent 77e3e3b commit 0ae2a6e
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 37 deletions.
15 changes: 5 additions & 10 deletions CHANGELOG.md
@@ -1,13 +1,8 @@
# Change Log
## 0.0.2

All notable changes to this project will be documented in this file.
* Migrate to Null safety.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## 0.0.1

## [0.0.1] - 2021-03-30

### Added

- **Initial release**
- lit_relative_date_time - A Flutter package to generate relative dates to show differences in time in localized and human-readable format..
* Initial release
* lit_relative_date_time - A Flutter package to generate relative dates to show differences in time in localized and human-readable format.
4 changes: 2 additions & 2 deletions example/pubspec.lock
Expand Up @@ -45,7 +45,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.1"
version: "0.0.2"
meta:
dependency: transitive
description:
Expand Down Expand Up @@ -80,5 +80,5 @@ packages:
source: hosted
version: "2.1.0"
sdks:
dart: ">=2.12.0-0 <3.0.0"
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.17.0"
2 changes: 1 addition & 1 deletion lib/lit_relative_date_time.dart
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart = 2.8


/// A Flutter package to generate relative dates to show differences in time in localized and human-readable format.
///
Expand Down
5 changes: 0 additions & 5 deletions lib/localization/relative_date_format.dart
Expand Up @@ -75,31 +75,26 @@ class RelativeDateFormat {
return _isSingular(relativeDateTime)
? _timeUnitsSingular[0]
: _timeUnitsPlural[0];
break;

case LitTimeUnit.minute:
return _isSingular(relativeDateTime)
? _timeUnitsSingular[1]
: _timeUnitsPlural[1];
break;

case LitTimeUnit.hour:
return _isSingular(relativeDateTime)
? _timeUnitsSingular[2]
: _timeUnitsPlural[2];
break;

case LitTimeUnit.day:
return _isSingular(relativeDateTime)
? _timeUnitsSingular[3]
: _timeUnitsPlural[3];
break;

default:
return _isSingular(relativeDateTime)
? _timeUnitsSingular[4]
: _timeUnitsPlural[4];
break;
}
}

Expand Down
18 changes: 8 additions & 10 deletions lib/model/relative_date_localization.dart
@@ -1,5 +1,3 @@
import 'package:flutter/foundation.dart';

/// Model class to describe all data required for localizing the formatted
/// [RelativeDateTime].
class RelativeDateLocalization {
Expand Down Expand Up @@ -72,14 +70,14 @@ class RelativeDateLocalization {
/// ],
/// ```
const RelativeDateLocalization({
@required this.languageCode,
@required this.timeUnitsSingular,
@required this.timeUnitsPlural,
@required this.prepositionPast,
@required this.prepositionFuture,
@required this.atTheMoment,
@required this.formatOrderPast,
@required this.formatOrderFuture,
required this.languageCode,
required this.timeUnitsSingular,
required this.timeUnitsPlural,
required this.prepositionPast,
required this.prepositionFuture,
required this.atTheMoment,
required this.formatOrderPast,
required this.formatOrderFuture,
});
}

Expand Down
5 changes: 2 additions & 3 deletions lib/model/relative_date_time.dart
@@ -1,4 +1,3 @@
import 'package:flutter/foundation.dart';
import 'package:lit_relative_date_time/lit_relative_date_time.dart';
import 'package:lit_relative_date_time/controller/relative_date_time_controller.dart';

Expand All @@ -14,8 +13,8 @@ class RelativeDateTime {
///
/// Ensure to provide two comparable [DateTime] objects.
RelativeDateTime({
@required this.dateTime,
@required this.other,
required this.dateTime,
required this.other,
});

/// Returns the calculated [TimeDifference].
Expand Down
5 changes: 2 additions & 3 deletions lib/model/time_difference.dart
@@ -1,4 +1,3 @@
import 'package:flutter/foundation.dart';
import 'package:lit_relative_date_time/model/lit_time_unit.dart';

/// A model class to describe a relative date time based on the largest [TimeUnit]
Expand All @@ -22,8 +21,8 @@ class TimeDifference {
///
/// * [unit] is the time unit of the date.
const TimeDifference({
@required this.value,
@required this.unit,
required this.value,
required this.unit,
});

/// States whether the [TimeDifference]'unit contains the smallest value available (second).
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Expand Up @@ -47,5 +47,5 @@ packages:
source: hosted
version: "2.1.0"
sdks:
dart: ">=2.12.0-0 <3.0.0"
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.17.0"
4 changes: 2 additions & 2 deletions pubspec.yaml
@@ -1,10 +1,10 @@
name: lit_relative_date_time
description: A Flutter package to generate relative dates to show differences in time in localized and human-readable format.
version: 0.0.1
version: 0.0.2
homepage: https://www.github.com/litlifesoftware/lit_relative_date_time

environment:
sdk: ">=2.8.0 <3.0.0"
sdk: ">=2.12.0 <3.0.0"
flutter: ">=1.17.0"

dependencies:
Expand Down

0 comments on commit 0ae2a6e

Please sign in to comment.