Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/android_alarm_manager/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.4.6 - null safety
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update to: ## 0.5.0-null-safety


* Migrate to null safety
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a period here.


## 0.4.5+20

* Update the example app: remove the deprecated `RaisedButton` and `FlatButton` widgets.
Expand Down
16 changes: 8 additions & 8 deletions packages/android_alarm_manager/lib/android_alarm_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void _alarmManagerCallbackDispatcher() {

// PluginUtilities.getCallbackFromHandle performs a lookup based on the
// callback handle and returns a tear-off of the original callback.
final Function closure = PluginUtilities.getCallbackFromHandle(handle);
final Function? closure = PluginUtilities.getCallbackFromHandle(handle);

if (closure == null) {
print('Fatal: could not find callback');
Expand Down Expand Up @@ -71,13 +71,13 @@ class AndroidAlarmManager {
// Callback used to get the handle for a callback. It's
// [PluginUtilities.getCallbackHandle] by default.
static _GetCallbackHandle _getCallbackHandle =
(Function callback) => PluginUtilities.getCallbackHandle(callback);
(Function callback) => PluginUtilities.getCallbackHandle(callback)!;

/// This is exposed for the unit tests. It should not be accessed by users of
/// the plugin.
@visibleForTesting
static void setTestOverides(
{_Now now, _GetCallbackHandle getCallbackHandle}) {
{_Now? now, _GetCallbackHandle? getCallbackHandle}) {
_now = (now ?? _now);
_getCallbackHandle = (getCallbackHandle ?? _getCallbackHandle);
}
Expand All @@ -93,7 +93,7 @@ class AndroidAlarmManager {
if (handle == null) {
return false;
}
final bool r = await _channel.invokeMethod<bool>(
final bool? r = await _channel.invokeMethod<bool>(
'AlarmService.start', <dynamic>[handle.toRawHandle()]);
return r ?? false;
}
Expand Down Expand Up @@ -211,7 +211,7 @@ class AndroidAlarmManager {
if (handle == null) {
return false;
}
final bool r =
final bool? r =
await _channel.invokeMethod<bool>('Alarm.oneShotAt', <dynamic>[
id,
alarmClock,
Expand Down Expand Up @@ -262,7 +262,7 @@ class AndroidAlarmManager {
Duration duration,
int id,
Function callback, {
DateTime startAt,
DateTime? startAt,
bool exact = false,
bool wakeup = false,
bool rescheduleOnReboot = false,
Expand All @@ -278,7 +278,7 @@ class AndroidAlarmManager {
if (handle == null) {
return false;
}
final bool r = await _channel.invokeMethod<bool>(
final bool? r = await _channel.invokeMethod<bool>(
'Alarm.periodic', <dynamic>[
id,
exact,
Expand All @@ -299,7 +299,7 @@ class AndroidAlarmManager {
/// Returns a [Future] that resolves to `true` on success and `false` on
/// failure.
static Future<bool> cancel(int id) async {
final bool r =
final bool? r =
await _channel.invokeMethod<bool>('Alarm.cancel', <dynamic>[id]);
return (r == null) ? false : r;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/android_alarm_manager/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Flutter plugin for accessing the Android AlarmManager service, and
# 0.4.y+z is compatible with 1.0.0, if you land a breaking change bump
# the version to 2.0.0.
# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
version: 0.4.5+20
version: 0.4.6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be 0.5.0-null-safety

Copy link
Contributor Author

@thisisamank thisisamank Feb 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @bkonyi Thanks for reviewing the code. All the variables in the test directory are initialized at the declaration, and there are no compile-time errors. Can you suggest changes for the test directory, if any?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, awesome, then I guess there's nothing to do there :-)

homepage: https://github.com/flutter/plugins/tree/master/packages/android_alarm_manager

dependencies:
Expand All @@ -24,5 +24,5 @@ flutter:
pluginClass: AndroidAlarmManagerPlugin

environment:
sdk: ">=2.1.0 <3.0.0"
sdk: '>=2.12.0-0 <3.0.0'
flutter: ">=1.12.13+hotfix.5"