mobile_operator_info 2.0.0 copy "mobile_operator_info: ^2.0.0" to clipboard
mobile_operator_info: ^2.0.0 copied to clipboard

A Flutter plugin for retrieving mobile operator information such as operator name, mobile country code (MCC), and mobile network code (MNC).

example/lib/main.dart

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:mobile_operator_info/mobile_operator_info.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 _operatorInfo = 'Unknown';
  final _mobileOperatorInfoPlugin = MobileOperatorInfo();

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

  Future<void> initPlatformState() async {
    MobileOperatorInfoData info;
    try {
      info = await _mobileOperatorInfoPlugin.getMobileOperatorInfo();
    } on PlatformException {
      info = MobileOperatorInfoData();
    }

    if (!mounted) return;

    setState(() {
      _operatorInfo = info.toString();
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('Running on: $_operatorInfo\n'),
        ),
      ),
    );
  }
}
0
likes
150
points
561
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for retrieving mobile operator information such as operator name, mobile country code (MCC), and mobile network code (MNC).

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on mobile_operator_info

Packages that implement mobile_operator_info