搜索插件、代码仓与 APP 分类

插件详情v1.0.2

sim_card_info

用于访问SIM卡详细信息(如运营商名称、电话号码和国家代码)的Flutter插件,适用于电信相关应用。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1680
喜欢数
29
Pub 分数
140

安装插件

flutter pub add sim_card_info

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

sim_card_info 包是一个 Flutter 插件,可在多个平台上访问 SIM 卡详细信息,例如运营商名称、电话号码和国家代码。该插件专为需要实时 SIM 数据的电信相关应用开发人员设计。它支持 Android、iOS、Web、macOS、Windows 和 Linux,确保广泛的兼容性。通过简单的 API,它简化了需要用户移动网络信息的应用集成。该插件通过平台通道利用原生平台功能,在获得权限时提供可靠的数据。

适合场景

  • 电信应用开发
  • 通过手机号码检测进行用户引导
  • 基于载体的服务个性化
  • SIM卡验证工作流程
  • 移动网络诊断

主要特点

  • 访问运营商名称
  • 获取电话号码
  • 提供国家代码
  • 跨平台支持
  • 简单的 API 集成
  • 权限感知设计

适合对象

  • 开发电信应用的开发者
  • 需要基于SIM卡的用户身份验证的应用程序
  • 多平台移动应用
  • 需要网络运营商信息的服务

使用建议

  • Android 和 iOS 需要运行时权限
  • 某些设备上的数据可用性有限
  • Web 支持可能具有限制
  • 隐私合规要求
  • 并非所有硬件配置都可用

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

sim_card_info

A Flutter plugin to get SIM card information.

Features

  • Fetches SIM card information from the device.
  • Handles exceptions and returns appropriate messages.

Getting Started

Installation

Add sim_card_info to your pubspec.yaml file:

dependencies:
  sim_card_info: ^1.0.0

then run flutter pub get in your terminal.

Usage

Import
import 'package:sim_card_info/sim_card_info.dart';
Get SIM card information
final _simCardInfoPlugin = SimCardInfo();
List<SimInfo>? _simInfo;

// Retrieve SIM card information
simCardInfo = await _simCardInfoPlugin.getSimInfo() ?? [];
Handling Exceptions

In cases where retrieving information fails, especially on certain devices like iOS, utilize a try/catch block with a PlatformException:

  Future<void> initSimInfoState() async {
  List<SimInfo>? simCardInfo;
  // Platform messages may fail, so we use a try/catch PlatformException.
  // We also handle the message potentially returning null.
  try {
    simCardInfo = await _simCardInfoPlugin.getSimInfo() ?? [];
  } on PlatformException {
    simCardInfo = [];
    setState(() {
      isSupported = false;
    });
  }

  // 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(() {
    _simInfo = simCardInfo;
  });
}

Permissions

refer to example directory for a complete sample app usingsim_card_info plugin.

Issues and feedback

For any issue or feedback please create an issue.

License

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

所属分类

依赖

依赖清单 1 项

  • plugin_platform_interface^2.1.8

源码仓库

使用此插件的项目

暂无相关数据。