sim_number_picker

Last updated:

0 purchases

sim_number_picker Image
sim_number_picker Images
Add to Cart

Description:

sim number picker

sim_number_picker #
sim_number_picker is a Flutter package designed to streamline the process of retrieving phone number hints from the user's device. It leverages the Phone Number Hint API, which is powered by Google Play services, to seamlessly display a user's SIM-based phone numbers as hints.
Features #

No Additional Permissions: The package does not require any additional permission requests, ensuring a smooth user experience.
Eliminates Manual Input: Users no longer need to manually type in their phone numbers, reducing input errors and saving time.
No Google Account Required: Usage of the Phone Number Hint API does not necessitate a Google account, enhancing accessibility.
Not Tied to Sign-in/Sign-up Workflows: The functionality provided by sim_number_picker is not restricted to sign-in or sign-up processes, offering versatility in application.
Wide Android Version Support: The package offers broader compatibility across various Android versions compared to Autofill solutions.

DEMO #
TODO:p => Link to demo gif
Getting Started #
Installation #
To integrate sim_number_picker into your Flutter project, simply add it as a dependency in your pubspec.yaml file:
dependencies:
sim_number_picker: ^0.0.1
copied to clipboard
Then, run flutter pub get to install the package.
import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:sim_number_picker/sim_number_picker.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 _phoneNumber = '';
final _simNumberPickerPlugin = SimNumberPicker();

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

// Platform messages are asynchronous, so we initialize in an async method.
Future<void> getPhoneNumbers() async {
String phoneNumber;
// Platform messages may fail, so we use a try/catch PlatformException.
// We also handle the message potentially returning null.
try {
phoneNumber = await _simNumberPickerPlugin.getPhoneNumberHint() ??
'Unknown platform version';
} on PlatformException {
phoneNumber = 'Failed to get platform version.';
}

// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
if (!mounted) return;

setState(() {
_phoneNumber = phoneNumber;
});
}

@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(child: _body2()),
),
);
}

Widget _body2() {
return InkWell(
child: Container(
width: 200,
height: 50,
decoration: BoxDecoration(
color: Colors.lightGreen, borderRadius: BorderRadius.circular(8)),
child: Center(
child: Text(
'Phone number: $_phoneNumber',
)),
),
onTap: () {
getPhoneNumbers();
},
);
}
}
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.