From fee6ec57e713af233a908ced6d8f7acf4370efb5 Mon Sep 17 00:00:00 2001 From: Michael Bui <25263378+MaikuB@users.noreply.github.com> Date: Thu, 23 Jan 2020 21:58:52 +1100 Subject: [PATCH] [flutter_local_notifications] tweaks to id validation to used named ArgumentError constructors (#453) * tweaks to id validation to used named ArgumentError constructors * bump pubspec and update changelog --- flutter_local_notifications/CHANGELOG.md | 4 ++++ flutter_local_notifications/lib/src/helpers.dart | 6 +++--- flutter_local_notifications/pubspec.yaml | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/flutter_local_notifications/CHANGELOG.md b/flutter_local_notifications/CHANGELOG.md index b7fe3c4b6..7d6c1befc 100644 --- a/flutter_local_notifications/CHANGELOG.md +++ b/flutter_local_notifications/CHANGELOG.md @@ -1,3 +1,7 @@ +# [1.1.2] +* Passing a null notification id now throws an `ArgumentError`. Thanks to PR from [talmor_guy](https://github.com/talmor-guy) +* Slight tweak to message displayed with by `ArgumentError` when notification id is not within range of a 32-bit integer + # [1.1.1] * [Android] Added ability to specify timeout duration of notification * [Android] Added ability to specify the notification category diff --git a/flutter_local_notifications/lib/src/helpers.dart b/flutter_local_notifications/lib/src/helpers.dart index 447f5ef89..11901e7e2 100644 --- a/flutter_local_notifications/lib/src/helpers.dart +++ b/flutter_local_notifications/lib/src/helpers.dart @@ -2,11 +2,11 @@ /// Ensures IDs are valid 32-bit integers. void validateId(int id) { if (id == null) { - throw ArgumentError('id must not be null'); + throw ArgumentError.notNull('id'); } if (id > 0x7FFFFFFF || id < -0x80000000) { - throw ArgumentError( - 'id must fit within the size of a 32-bit integer i.e. in the range [-2^31, 2^31 - 1]'); + throw ArgumentError.value(id, 'id', + 'must fit within the size of a 32-bit integer i.e. in the range [-2^31, 2^31 - 1]'); } } diff --git a/flutter_local_notifications/pubspec.yaml b/flutter_local_notifications/pubspec.yaml index 645d5c76d..0d49c361b 100644 --- a/flutter_local_notifications/pubspec.yaml +++ b/flutter_local_notifications/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_local_notifications description: A cross platform plugin for displaying and scheduling local notifications for Flutter applications with the ability to customise for each platform. -version: 1.1.1 +version: 1.1.2 homepage: https://github.com/MaikuB/flutter_local_notifications/tree/master/flutter_local_notifications dependencies: