google_phone_number_hint 0.0.3 copy "google_phone_number_hint: ^0.0.3" to clipboard
google_phone_number_hint: ^0.0.3 copied to clipboard

PlatformAndroid

A new Flutter plugin to get the phone number hint from Google Play Services.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:google_phone_number_hint/google_phone_number_hint.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String? _mobileNumber;

  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
      _getGoogleMobileNumber();
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(useMaterial3: false),
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Google Phone Number Hint Example'),
        ),
        body: Center(
          child: Text(_mobileNumber ?? 'Loading...'),
        ),
      ),
    );
  }

  void _getGoogleMobileNumber() {
    GooglePhoneNumberHint().getMobileNumber().then((number) {
      setState(() {
        _mobileNumber = number;
      });
    });
  }
}
copied to clipboard
5
likes
160
points
110
downloads

Publisher

unverified uploader

Weekly Downloads

2024.09.15 - 2025.03.30

A new Flutter plugin to get the phone number hint from Google Play Services.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on google_phone_number_hint