You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
782 B
Dart
34 lines
782 B
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
class WhatsappMethodChannel {
|
|
static const MethodChannel _channel = MethodChannel('whats_app_otp');
|
|
|
|
FutureOr<void> handleHandShake() async {
|
|
try {
|
|
await _channel.invokeMethod("performHandShake");
|
|
|
|
} on PlatformException catch (e) {
|
|
print("Failed to launch PenguinIn: '${e.message}'.");
|
|
}
|
|
}
|
|
|
|
Future<bool> isWhatsAppInstalled() async {
|
|
try {
|
|
return await _channel.invokeMethod("isWhatsAppInstalled");
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
Future<String> startListening() async {
|
|
try{
|
|
String code = await _channel.invokeMethod("startListening");
|
|
print("the code in flutter is ${code}");
|
|
return code;
|
|
}catch(e){
|
|
return "";
|
|
}
|
|
}
|
|
} |