gps_connectivity 0.0.4 copy "gps_connectivity: ^0.0.4" to clipboard
gps_connectivity: ^0.0.4 copied to clipboard

PlatformAndroid

A Flutter plugin that checks whether GPS is ON or OFF, it can listen for GPS change.

gps_connectivity #

A Flutter plugin that checks whether GPS is ON or OFF, it can listen for GPS change. Inspired by connectivity_plus plugin

Platform Support #

Only Android for now.

Usage #

Sample usage to check current GPS status:

import 'package:gps_connectivity/gps_connectivity.dart';

bool isGpsEnabled = await (GpsConnectivity().checkGpsConnectivity());
if (isGpsEnabled) {
  // GPS is ON.
} else {
  // GPS is OFF.
}

You can also listen for GPS state changes by subscribing to the stream exposed by plugin:

import 'package:gps_connectivity/gps_connectivity.dart';

@override
initState() {
  super.initState();

  subscription = GpsConnectivity().onGpsConnectivityChanged.listen((bool result) {
    // Got a new GPS status!
  });
}

// Be sure to cancel subscription after you are done
@override
dispose() {
  subscription.cancel();
  super.dispose();
}
7
likes
140
pub points
78%
popularity

Publisher

unverified uploader

A Flutter plugin that checks whether GPS is ON or OFF, it can listen for GPS change.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, meta, plugin_platform_interface

More

Packages that depend on gps_connectivity