import 'dart:async'; import 'package:flutter/services.dart'; class WhatsappMethodChannel { static const MethodChannel _channel = MethodChannel('whats_app_otp'); FutureOr handleHandShake() async { try { await _channel.invokeMethod("performHandShake"); } on PlatformException catch (e) { print("Failed to launch PenguinIn: '${e.message}'."); } } Future isWhatsAppInstalled() async { try { return await _channel.invokeMethod("isWhatsAppInstalled"); } catch (e) { return false; } } Future startListening() async { try{ String code = await _channel.invokeMethod("startListening"); print("the code in flutter is ${code}"); return code; }catch(e){ return ""; } } }