flutter_plugin_openwhatsappad 0.0.1 flutter_plugin_openwhatsappad: ^0.0.1 copied to clipboard
A new plugin project, To open third-party WhatsApp in an app.
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_plugin_openwhatsapp/flutter_plugin_openwhatsapp.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example'),
),
body: Center(
child: IconButton(
onPressed: () async {
final flutterPlugin = FlutterPluginOpenwhatsapp();
var platform = defaultTargetPlatform;
if (platform == TargetPlatform.android) {
String? result = await flutterPlugin.openWhatsApp(
phoneNumber: '0123456789',
text: 'Hi, this is a test message!',
);
debugPrint('>>>: $result');
}
},
icon: const Icon(
Icons.send,
),
),
),
),
);
}
}