Skip to content

Commit d4799e4

Browse files
authored
Merge pull request #7 from renancaraujo/nnbd
Migrate to nnbd
2 parents c33716b + 8de33a7 commit d4799e4

7 files changed

Lines changed: 102 additions & 116 deletions

File tree

analysis_options.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ linter:
77
- always_put_control_body_on_new_line
88
- always_require_non_null_named_parameters
99
- annotate_overrides
10-
- avoid_as
1110
- avoid_classes_with_only_static_members
1211
- avoid_empty_else
1312
- avoid_field_initializers_in_const_classes

example/pubspec.lock

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@ packages:
77
name: angles
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "1.2.1"
10+
version: "2.0.0"
11+
clock:
12+
dependency: transitive
13+
description:
14+
name: clock
15+
url: "https://pub.dartlang.org"
16+
source: hosted
17+
version: "1.1.0"
1118
daylight:
1219
dependency: "direct main"
1320
description:
@@ -21,20 +28,20 @@ packages:
2128
name: intl
2229
url: "https://pub.dartlang.org"
2330
source: hosted
24-
version: "0.16.1"
31+
version: "0.17.0"
2532
meta:
2633
dependency: transitive
2734
description:
2835
name: meta
2936
url: "https://pub.dartlang.org"
3037
source: hosted
31-
version: "1.1.8"
38+
version: "1.3.0"
3239
path:
3340
dependency: transitive
3441
description:
3542
name: path
3643
url: "https://pub.dartlang.org"
3744
source: hosted
38-
version: "1.6.4"
45+
version: "1.8.0"
3946
sdks:
40-
dart: ">=2.6.0 <3.0.0"
47+
dart: ">=2.12.0 <3.0.0"

example/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: daylight_example
22
description: Get the sunset and sunrise times for a geolocation without having to access any api.
33
version: 0.2.0
44
homepage: https://github.com/renancaraujo/daylight
5+
publish_to: none
56

67
environment:
78
sdk: ">=2.6.0 <3.0.0"

lib/daylight.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ class DaylightResult {
6161
DaylightResult(this.sunrise, this.sunset, this._date, this.location);
6262

6363
/// Time of the sunset in UTC
64-
final DateTime sunrise;
64+
final DateTime? sunrise;
6565

6666
/// Time of the sunset in UTC
67-
final DateTime sunset;
67+
final DateTime? sunset;
6868

6969
final DaylightLocation location;
7070

@@ -112,7 +112,7 @@ class DaylightCalculator {
112112
/// Calculate the time of an specific sun event
113113
///
114114
/// Returns in UTC.
115-
DateTime calculateEvent(DateTime date, Zenith zenith, EventType type) {
115+
DateTime? calculateEvent(DateTime date, Zenith zenith, EventType type) {
116116
final lastMidnight = DateTime(date.year, date.month, date.day);
117117

118118
final eventMils = _calculate(date, zenith, type);
@@ -123,7 +123,7 @@ class DaylightCalculator {
123123
return DateTime.fromMillisecondsSinceEpoch(mils, isUtc: true);
124124
}
125125

126-
double _calculate(DateTime time, Zenith zenith, EventType type) {
126+
double? _calculate(DateTime time, Zenith zenith, EventType type) {
127127
final double baseLongHour = location.long / 15;
128128

129129
final double hour = _longToHour(time, type == EventType.sunrise ? 6 : 18);

0 commit comments

Comments
 (0)