gms_check 1.0.2 copy "gms_check: ^1.0.2" to clipboard
gms_check: ^1.0.2 copied to clipboard

PlatformAndroid

This tiny plugin simply check if Google Services is avalable in the Android device.

gms_check #

This tiny plugin simply checks if Google Services is available on the Android device.

For other platform, it always return true as default.

This will help you to avoid initializing unnecessary services that require Google Services to run on the device, such as: Firebase App Check, Firebase Cloud Messaging,...

Usage #

  1. Call await GmsCheck().checkGmsAvailability() before runApp() in main().
Future<void> main() async {
  /// Need to call GmsCheck().checkGmsAvailability()
  /// only once before runApp function.
  await GmsCheck().checkGmsAvailability();

  runApp(const MyApp());
}
  1. Use GmsCheck().isGmsAvailable any where in the app.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: Text('GMS available: ${GmsCheck().isGmsAvailable}'),
        ),
      ),
    );
  }

You can use GmsCheck().isGmsAvailable to conditionally initialize Firebase services.

  if (GmsCheck().isGmsAvailable) {
    _initFirebaseAppCheck();
    _initFirebaseCloudMessaging();
  }
  _initFirebaseRemoteConfig();
8
likes
160
pub points
95%
popularity

Publisher

verified publishersofluffy.io

This tiny plugin simply check if Google Services is avalable in the Android device.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on gms_check