diff --git a/example/android/app/src/main/kotlin/com/intivoto/example/MainActivity.kt b/example/android/app/src/main/kotlin/com/intivoto/example/MainActivity.kt
new file mode 100644
index 0000000..bb6a841
--- /dev/null
+++ b/example/android/app/src/main/kotlin/com/intivoto/example/MainActivity.kt
@@ -0,0 +1,6 @@
+package com.intivoto.example
+
+import io.flutter.embedding.android.FlutterActivity
+
+class MainActivity: FlutterActivity() {
+}
diff --git a/example/android/app/src/main/res/drawable-v21/launch_background.xml b/example/android/app/src/main/res/drawable-v21/launch_background.xml
new file mode 100644
index 0000000..f74085f
--- /dev/null
+++ b/example/android/app/src/main/res/drawable-v21/launch_background.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
diff --git a/example/android/app/src/main/res/values-night/styles.xml b/example/android/app/src/main/res/values-night/styles.xml
new file mode 100644
index 0000000..449a9f9
--- /dev/null
+++ b/example/android/app/src/main/res/values-night/styles.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock
index 000a4ef..91ddbfa 100644
--- a/example/ios/Podfile.lock
+++ b/example/ios/Podfile.lock
@@ -19,10 +19,10 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_local_notifications/ios"
SPEC CHECKSUMS:
- Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
+ Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
flutter_geofence: 08e5427c56c540ffac97425b8e10dd598912fb3d
- flutter_local_notifications: 9e4738ce2471c5af910d961a6b7eadcf57c50186
+ flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
-COCOAPODS: 1.9.3
+COCOAPODS: 1.10.1
diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj
index 85863ab..5b0f66a 100644
--- a/example/ios/Runner.xcodeproj/project.pbxproj
+++ b/example/ios/Runner.xcodeproj/project.pbxproj
@@ -227,13 +227,11 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
- "${PODS_ROOT}/../Flutter/Flutter.framework",
"${BUILT_PRODUCTS_DIR}/flutter_geofence/flutter_geofence.framework",
"${BUILT_PRODUCTS_DIR}/flutter_local_notifications/flutter_local_notifications.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
- "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_geofence.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_local_notifications.framework",
);
diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
index 1d526a1..919434a 100644
--- a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+++ b/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -2,6 +2,6 @@
+ location = "self:">
diff --git a/example/lib/main.dart b/example/lib/main.dart
index f9db424..83c6c45 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -29,8 +29,8 @@ class _MyAppState extends State {
new AndroidInitializationSettings('app_icon');
var initializationSettingsIOS =
IOSInitializationSettings(onDidReceiveLocalNotification: null);
- var initializationSettings = InitializationSettings(
- initializationSettingsAndroid, initializationSettingsIOS);
+ var initializationSettings = InitializationSettings(android:
+ initializationSettingsAndroid, iOS: initializationSettingsIOS);
flutterLocalNotificationsPlugin.initialize(initializationSettings,
onSelectNotification: null);
}
@@ -116,7 +116,7 @@ class _MyAppState extends State {
onPressed: () {
Geofence.getCurrentLocation().then((coordinate) {
print(
- "great got latitude: ${coordinate.latitude} and longitude: ${coordinate.longitude}");
+ "great got latitude: ${coordinate?.latitude} and longitude: ${coordinate?.longitude}");
});
}),
RaisedButton(
@@ -145,12 +145,12 @@ class _MyAppState extends State {
Future.delayed(Duration(seconds: 5)).then((result) async {
var androidPlatformChannelSpecifics = AndroidNotificationDetails(
'your channel id', 'your channel name', 'your channel description',
- importance: Importance.Max,
- priority: Priority.High,
+ importance: Importance.high,
+ priority: Priority.high,
ticker: 'ticker');
var iOSPlatformChannelSpecifics = IOSNotificationDetails();
- var platformChannelSpecifics = NotificationDetails(
- androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
+ var platformChannelSpecifics = NotificationDetails(android:
+ androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics);
await flutterLocalNotificationsPlugin.show(
rng.nextInt(100000), title, subtitle, platformChannelSpecifics,
payload: 'item x');
diff --git a/example/pubspec.lock b/example/pubspec.lock
index 59327a8..5364419 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -7,56 +7,56 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.5.0-nullsafety.3"
+ version: "2.5.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.0-nullsafety.3"
+ version: "2.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0-nullsafety.5"
+ version: "1.1.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0-nullsafety.3"
+ version: "1.2.0"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0-nullsafety.3"
+ version: "1.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
- version: "1.15.0-nullsafety.5"
+ version: "1.15.0"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
- version: "0.1.3"
+ version: "1.0.2"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0-nullsafety.3"
+ version: "1.2.0"
flutter:
dependency: "direct main"
description: flutter
@@ -75,14 +75,14 @@ packages:
name: flutter_local_notifications
url: "https://pub.dartlang.org"
source: hosted
- version: "1.5.0+1"
+ version: "5.0.0"
flutter_local_notifications_platform_interface:
dependency: transitive
description:
name: flutter_local_notifications_platform_interface
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.1"
+ version: "3.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
@@ -94,35 +94,35 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.10-nullsafety.3"
+ version: "0.12.10"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0-nullsafety.6"
+ version: "1.3.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.0-nullsafety.3"
+ version: "1.8.0"
platform:
dependency: transitive
description:
name: platform
url: "https://pub.dartlang.org"
source: hosted
- version: "2.2.1"
+ version: "3.0.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.3"
+ version: "2.0.0"
sky_engine:
dependency: transitive
description: flutter
@@ -134,56 +134,63 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.0-nullsafety.4"
+ version: "1.8.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
- version: "1.10.0-nullsafety.6"
+ version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.0-nullsafety.3"
+ version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0-nullsafety.3"
+ version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0-nullsafety.3"
+ version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.2.19-nullsafety.6"
+ version: "0.2.19"
+ timezone:
+ dependency: transitive
+ description:
+ name: timezone
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.7.0-nullsafety.0"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0-nullsafety.5"
+ version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.0-nullsafety.5"
+ version: "2.1.0"
sdks:
dart: ">=2.12.0-0.0 <3.0.0"
- flutter: ">=1.12.13+hotfix.5 <2.0.0"
+ flutter: ">=1.12.13+hotfix.5"
diff --git a/example/pubspec.yaml b/example/pubspec.yaml
index 91078e0..9458fa4 100644
--- a/example/pubspec.yaml
+++ b/example/pubspec.yaml
@@ -3,7 +3,7 @@ description: Demonstrates how to use the geofence plugin.
publish_to: 'none'
environment:
- sdk: ">=2.1.0 <3.0.0"
+ sdk: ">=2.12.0-0 <3.0.0"
dependencies:
flutter:
@@ -11,8 +11,8 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
- cupertino_icons: ^0.1.2
- flutter_local_notifications: ^1.4.4+2
+ cupertino_icons: ^1.0.2
+ flutter_local_notifications: ^5.0.0
dev_dependencies:
flutter_test:
diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart
index b53f3a1..2ef893d 100644
--- a/example/test/widget_test.dart
+++ b/example/test/widget_test.dart
@@ -19,7 +19,7 @@ void main() {
expect(
find.byWidgetPredicate(
(Widget widget) =>
- widget is Text && widget.data.startsWith('Running on:'),
+ widget is Text && (widget.data ?? "").startsWith('Running on:'),
),
findsOneWidget,
);
diff --git a/example/web/favicon.png b/example/web/favicon.png
new file mode 100644
index 0000000..8aaa46a
Binary files /dev/null and b/example/web/favicon.png differ
diff --git a/example/web/icons/Icon-192.png b/example/web/icons/Icon-192.png
new file mode 100644
index 0000000..b749bfe
Binary files /dev/null and b/example/web/icons/Icon-192.png differ
diff --git a/example/web/icons/Icon-512.png b/example/web/icons/Icon-512.png
new file mode 100644
index 0000000..88cfd48
Binary files /dev/null and b/example/web/icons/Icon-512.png differ
diff --git a/example/web/index.html b/example/web/index.html
new file mode 100644
index 0000000..1460b5e
--- /dev/null
+++ b/example/web/index.html
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ example
+
+
+
+
+
+
+
+
diff --git a/example/web/manifest.json b/example/web/manifest.json
new file mode 100644
index 0000000..8c01291
--- /dev/null
+++ b/example/web/manifest.json
@@ -0,0 +1,23 @@
+{
+ "name": "example",
+ "short_name": "example",
+ "start_url": ".",
+ "display": "standalone",
+ "background_color": "#0175C2",
+ "theme_color": "#0175C2",
+ "description": "A new Flutter project.",
+ "orientation": "portrait-primary",
+ "prefer_related_applications": false,
+ "icons": [
+ {
+ "src": "icons/Icon-192.png",
+ "sizes": "192x192",
+ "type": "image/png"
+ },
+ {
+ "src": "icons/Icon-512.png",
+ "sizes": "512x512",
+ "type": "image/png"
+ }
+ ]
+}
diff --git a/lib/Geolocation.dart b/lib/Geolocation.dart
index dab891b..a958d50 100644
--- a/lib/Geolocation.dart
+++ b/lib/Geolocation.dart
@@ -4,7 +4,7 @@ class Geolocation {
final double radius; // in meters
final String id;
- const Geolocation({this.latitude, this.longitude, this.radius, this.id});
+ const Geolocation({required this.latitude, required this.longitude, required this.radius, required this.id});
}
enum GeolocationEvent { entry, exit }
diff --git a/lib/geofence.dart b/lib/geofence.dart
index 35e653d..5d02dcd 100644
--- a/lib/geofence.dart
+++ b/lib/geofence.dart
@@ -17,8 +17,8 @@ class Coordinate {
class Geofence {
static const MethodChannel _channel = const MethodChannel('geofence');
- static GeofenceCallback _entryCallback;
- static GeofenceCallback _exitCallback;
+ static GeofenceCallback _entryCallback = (location){};
+ static GeofenceCallback _exitCallback = (location){};
//ignore: close_sinks
static StreamController _userLocationUpdated =
@@ -26,7 +26,7 @@ class Geofence {
// ignore: close_sinks
static StreamController backgroundLocationUpdated =
new StreamController();
- static Stream _broadcastLocationStream;
+ static Stream? _broadcastLocationStream;
/// Adds a geolocation for a certain geo-event
static Future addGeolocation(
@@ -58,9 +58,9 @@ class Geofence {
}
/// Get the latest location the user has been.
- static Future getCurrentLocation() async {
+ static Future getCurrentLocation() async {
_channel.invokeMethod("getUserLocation", null);
- return _broadcastLocationStream.first;
+ return _broadcastLocationStream?.first;
}
static Future startListeningForLocationChanges() {
@@ -86,7 +86,7 @@ class Geofence {
longitude: call.arguments["longitude"] as double,
radius: call.arguments["radius"] as double,
id: call.arguments["id"] as String);
- _entryCallback(location);
+ _entryCallback(location);
} else if (call.method == "exit") {
Geolocation location = Geolocation(
latitude: call.arguments["latitude"] as double,
diff --git a/pubspec.lock b/pubspec.lock
index 1577117..52ed0ad 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -7,49 +7,49 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.5.0-nullsafety.3"
+ version: "2.5.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.0-nullsafety.3"
+ version: "2.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0-nullsafety.5"
+ version: "1.1.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0-nullsafety.3"
+ version: "1.2.0"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0-nullsafety.3"
+ version: "1.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
- version: "1.15.0-nullsafety.5"
+ version: "1.15.0"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0-nullsafety.3"
+ version: "1.2.0"
flutter:
dependency: "direct main"
description: flutter
@@ -66,21 +66,21 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.10-nullsafety.3"
+ version: "0.12.10"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0-nullsafety.6"
+ version: "1.3.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.0-nullsafety.3"
+ version: "1.8.0"
sky_engine:
dependency: transitive
description: flutter
@@ -92,56 +92,56 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.0-nullsafety.4"
+ version: "1.8.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
- version: "1.10.0-nullsafety.6"
+ version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.0-nullsafety.3"
+ version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0-nullsafety.3"
+ version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0-nullsafety.3"
+ version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.2.19-nullsafety.6"
+ version: "0.2.19"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0-nullsafety.5"
+ version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.0-nullsafety.5"
+ version: "2.1.0"
sdks:
dart: ">=2.12.0-0.0 <3.0.0"
- flutter: ">=1.12.0 <2.0.0"
+ flutter: ">=1.12.0"
diff --git a/pubspec.yaml b/pubspec.yaml
index 0e3c1c1..1a06dbf 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -4,7 +4,7 @@ version: 0.4.0
homepage: https://github.com/DwayneCoussement/geofence
environment:
- sdk: ">=2.1.0 <3.0.0"
+ sdk: ">=2.12.0-0 <3.0.0"
flutter: ">=1.12.0 <2.0.0"
dependencies: