simple_telephony 0.0.5 copy "simple_telephony: ^0.0.5" to clipboard
simple_telephony: ^0.0.5 copied to clipboard

Provides very simple telephony info for both iOS and Android. Detects whether the device support phone calls.

example/lib/main.dart

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:simple_telephony/simple_telephony.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  bool _isVoiceCapable = false;

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

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    bool isVoiceCapable = false;

    try {
      isVoiceCapable = await SimpleTelephony.isVoiceCapable ?? false;
    } on PlatformException {
      print('Failed to get isVoiceCapable.');
    }

    if (!mounted) return;

    setState(() {
      _isVoiceCapable = isVoiceCapable;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('_isVoiceCapable: $_isVoiceCapable\n'),
        ),
      ),
    );
  }
}
3
likes
130
pub points
7%
popularity

Publisher

verified publisherdaewonkim.com

Provides very simple telephony info for both iOS and Android. Detects whether the device support phone calls.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on simple_telephony