phone_number_suggestion_3 0.0.1 copy "phone_number_suggestion_3: ^0.0.1" to clipboard
phone_number_suggestion_3: ^0.0.1 copied to clipboard

The flutter_google_phone_number_suggestion package is a powerful Flutter plugin that seamlessly integrates with the Google API to offer phone number suggestions directly from a user's device. It simpl [...]

pub package package publisher

Phone Number Suggestion Plugin #

Phone Number Suggestion Plugin is a Flutter plugin that allows you to fetch phone number suggestions using a bottom sheet. The plugin communicates with the native platform to show the bottom sheet and retrieve the phone number suggestion.

Features #

  • Fetch phone number suggestions using a bottom sheet.
  • Handle different result cases such as success, failure, closed by user, or error occurred.

Installation #

To use the Phone Number Suggestion Plugin, add it to your pubspec.yaml file:

dependencies:
  phone_number_suggestion_plugin: ^1.0.0 # Replace with the latest version

Then, install the dependencies by running:

flutter pub get

Usage #

To fetch the phone number suggestion, call the _invokeBottomSheet method:

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

class MyWidget extends StatelessWidget {
 @override
 Widget build(BuildContext context) {
   return ElevatedButton(
     onPressed: () async {
       PhoneNumber phoneNumber = await _invokeBottomSheet();
       String message = printMessage(pluginData: phoneNumber);
       /// Handle the suggestion result using the 'message'.
     },
     child: Text('Fetch Phone Number'),
   );
 }
}

You can use the getMessage function to handle different result cases:

void printMessage({required PhoneNumber pluginData}) {
  switch (pluginData.runtimeType) {
    case Success:
      print('Phone number: ${(pluginData as Success).phoneNumber}');
      break;
    case Failure:
      print('Error message: ${(pluginData as Failure).errorMessage}');
      break;
    case ClosedByUser:
      print('Closed by user');
      break;
    case NoneOfTheSelected:
      print('Error occurred');
      break;
    default:
      throw Exception('Unknown type: ${pluginData.runtimeType}');
  }
}

Contributing #

Contributions to the Phone Number Suggestion Plugin are welcome! If you find a bug, have a feature request, or want to contribute to the project, please follow the contribution guidelines.

License #

This project is licensed under the MIT License - see the LICENSE file for details.

Buy Me a Coffee #

Buy Me A Coffee

6
likes
140
points
166
downloads

Publisher

unverified uploader

Weekly Downloads

The flutter_google_phone_number_suggestion package is a powerful Flutter plugin that seamlessly integrates with the Google API to offer phone number suggestions directly from a user's device. It simplifies the process of selecting phone numbers, streamlining your Flutter app's user experience.

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface

More

Packages that depend on phone_number_suggestion_3