launcher_utils 1.0.0
launcher_utils: ^1.0.0 copied to clipboard
A Flutter utility package to launch calls, messages, emails, WhatsApp, maps, and popular social apps easily.
launcher_utils #
A Flutter utility package to easily launch common communication and social media actions such as phone calls, SMS, email, WhatsApp, websites, maps, and popular social platforms.
Features #
- Make phone calls
- Send SMS messages with optional body
- Send emails with subject and body
- Open WhatsApp chats with pre-filled messages
- Open any website URL
- Show locations and directions in Google Maps
- Open Telegram chats
- Open Facebook Messenger chats
- Open Instagram profiles
- Send Tweets (X) with optional message
- Open YouTube channels
- Open LinkedIn profiles
- Open Facebook pages/profiles
- Open Spotify tracks or profiles
- Open arbitrary file URLs (PDF, DOC, etc.)
- Support for custom URI schemes (deep linking)
Installation #
Add this to your pubspec.yaml:
dependencies:
launcher_utils: ^1.0.0
Usage #
Example #
Here's a simple Flutter example demonstrating how to use launcher_utils to make calls, send messages, and open apps:
import 'package:flutter/material.dart';
import 'package:launcher_utils/launcher_utils.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Launcher Utils Demo',
home: Scaffold(
appBar: AppBar(title: const Text('Launcher Utils Example')),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () => LauncherUtils.call('1234567890'),
child: const Text('Call Phone'),
),
ElevatedButton(
onPressed: () => LauncherUtils.sms('1234567890', message: 'Hello!'),
child: const Text('Send SMS'),
),
ElevatedButton(
onPressed: () => LauncherUtils.email(
'example@example.com',
subject: 'Greetings',
body: 'Hello from Flutter!',
),
child: const Text('Send Email'),
),
ElevatedButton(
onPressed: () => LauncherUtils.whatsapp('1234567890', message: 'Hi WhatsApp!'),
child: const Text('Open WhatsApp'),
),
ElevatedButton(
onPressed: () => LauncherUtils.website('https://flutter.dev'),
child: const Text('Open Website'),
),
],
),
),
),
);
}
}