app_contact_checker 0.0.4 copy "app_contact_checker: ^0.0.4" to clipboard
app_contact_checker: ^0.0.4 copied to clipboard

A Flutter plugin to check if a phone number is registered on popular messaging apps like WhatsApp, Telegram, and more. Provides a simple and unified API for both Android and iOS.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:app_contact_checker/app_contact_checker.dart';
import 'package:wakelock_plus/wakelock_plus.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  WakelockPlus.enable();
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  bool _whatsAppChecker = false;
  bool _whatsAppBusinessChecker = false;
  bool _telegramChecker = false;
  String? _phoneNumber;
  final _appContactCheckerPlugin = AppContactChecker();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Plugin example app')),
        body: Padding(
          padding: const EdgeInsets.symmetric(horizontal: 20.0),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.stretch,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text('WhatsApp: $_whatsAppChecker\n'),
              Text('WhatsApp Business: $_whatsAppBusinessChecker\n'),
              Text('Telegram: $_telegramChecker\n'),
              Padding(
                padding: const EdgeInsets.symmetric(horizontal: 8.0),
                child: TextField(
                  decoration: InputDecoration(border: OutlineInputBorder(), hint: Text('+970591234567')),
                  keyboardType: TextInputType.phone,
                  onSubmitted: _checkPhone,
                  onChanged: (phoneNumber) => _phoneNumber = phoneNumber,
                ),
              ),
              SizedBox(height: 30),
              ElevatedButton(
                onPressed: () {
                  _checkPhone(_phoneNumber ?? '');
                },
                child: Text('Check'),
              ),
            ],
          ),
        ),
      ),
    );
  }

  Future<void> _checkPhone(String phoneNumber) async {
    _whatsAppChecker = await _appContactCheckerPlugin.isOnWhatsApp(phoneNumber);
    _whatsAppBusinessChecker = await _appContactCheckerPlugin
        .isOnWhatsAppBusiness(phoneNumber);
    _telegramChecker = await _appContactCheckerPlugin.isOnTelegram(phoneNumber);
    setState(() {});
  }
}
0
likes
160
points
239
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin to check if a phone number is registered on popular messaging apps like WhatsApp, Telegram, and more. Provides a simple and unified API for both Android and iOS.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Unlicense (license)

Dependencies

flutter, permission_handler, plugin_platform_interface

More

Packages that depend on app_contact_checker

Packages that implement app_contact_checker