Вы можете добавить запуск Flutter WhatsApp.
УСТАНОВКА: Сначала добавьте flutter_launch_whatsapp в качестве зависимости в вашем файле pubspe c .yaml.
В iOS добавить следующий список Info.plist:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>whatsapp</string>
</array>
Пример:
import 'package:flutter/material.dart';
import 'package:flutter_launch/flutter_launch.dart';
void main() => runApp(new MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
initState() {
super.initState();
}
void whatsAppOpen() async {
await FlutterLaunch.launchWathsApp(phone: "5534992016545", message: "Hello");
}
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new Scaffold(
appBar: new AppBar(
title: new Text('Plugin example app'),
),
body: new Center(
child: FlatButton(
child: Text("Open WhatsApp"),
onPressed: () {
whatsAppOpen();
},
)
),
),
);
}
}
Выше ссылка из: https://pub.dev/packages/flutter_launch
ИЛИ
Вы можете попробовать код ниже:
var whatsappUrl ="whatsapp://send?phone=$phone";
await canLaunch(whatsappUrl)? launch(whatsappUrl):print("open whatsapp app link or do a snackbar with notification that there is no whatsapp installed");