sim_phone_plus 0.0.2 copy "sim_phone_plus: ^0.0.2" to clipboard
sim_phone_plus: ^0.0.2 copied to clipboard

sim_phone_plus is a modern Flutter plugin that fetches SIM card phone numbers and carrier details with graceful permission handling, device compatibility checks, and a developer-friendly API. Designed [...]

sim_phone_plus #

A modern Flutter plugin that fetches SIM card phone numbers and carrier details with graceful permission handling, device compatibility checks, and a developer-friendly API.

Features #

  • Fetch SIM Details: Retrieve phone number, carrier name, country ISO, and SIM slot index.
  • Graceful Permissions: Automatically checks for READ_PHONE_STATE permission on Android and provides helper methods to request it.
  • Platform Safe: Returns structured "not supported" responses on iOS and web, ensuring your app never crashes.
  • Null-Safe & Typed: Clean, modern, and null-safe Dart code.

Platform Support #

Platform Supported
Android
iOS
Web
macOS
Windows
Linux

Installation #

Add sim_phone_plus to your pubspec.yaml dependencies:

dependencies:
  sim_phone_plus: ^0.0.1 # Replace with the latest version

Then, run flutter pub get.

Permissions #

Android #

This plugin requires the READ_PHONE_STATE permission. Add the following line to your android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.READ_PHONE_STATE"/>

Usage #

Import the package and create an instance of the plugin:

import 'package:sim_phone_plus/sim_phone_plus.dart';

final simPhonePlus = SimPhonePlus();

Check for Permissions and Get SIM Info #

It's best practice to check for permissions before trying to get SIM information.

Future<void> _getSimInfo() async {
  bool? hasPermission = await simPhonePlus.hasPermission();
  if (hasPermission == false) {
    await simPhonePlus.requestPermission();
  }

  final List<SimPhoneInfo> simInfo = await simPhonePlus.getSimPhoneInfo();
  // Use the simInfo list...
}

Example #

Here is a snippet from the example app, which displays a list of SIM cards.

ListView.builder(
  shrinkWrap: true,
  itemCount: _simPhoneInfo.length,
  itemBuilder: (context, index) {
    final sim = _simPhoneInfo[index];
    return ListTile(
      title: Text('SIM Card ${sim.slotIndex}'),
      subtitle: Text(
          'Carrier: ${sim.carrierName}\n'
          'Number: ${sim.phoneNumber ?? 'N/A'}\n'
          'Country ISO: ${sim.countryIso}\n'
          'Message: ${sim.message}'
      ),
    );
  },
)

Screenshots #

Before Permission After Permission
Before Permission After Permission

Note: The included screenshots are placeholders. Replace them with your own app screenshots.

Contributing #

Contributions are welcome! If you find a bug or have a feature request, please open an issue. If you want to contribute code, please open a pull request.

1
likes
130
points
22
downloads

Publisher

verified publisherarpitjai.com

Weekly Downloads

sim_phone_plus is a modern Flutter plugin that fetches SIM card phone numbers and carrier details with graceful permission handling, device compatibility checks, and a developer-friendly API. Designed for reliability, privacy awareness, and smooth UX across supported platforms.

Repository (GitHub)
View/report issues

Documentation

API reference

Funding

Consider supporting this project:

www.buymeacoffee.com

License

MIT (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface

More

Packages that depend on sim_phone_plus

Packages that implement sim_phone_plus