Flutter Open One other App :
On this weblog, discover how you can leverage Flutter highly effective capabilities to seamlessly open one app from one other. Find out about deep linking methods and greatest practices for making a easy consumer expertise in your Flutter functions.
Uncover how you can implement app-to-app communication effortlessly utilizing Flutter’s navigation options. Dive into sensible examples and step-by-step guides to grasp app navigation throughout the Flutter framework. Unlock the potential of connecting a number of apps and enhancing consumer interplay with this complete information to Flutter app-to-app navigation. Begin exploring the probabilities right this moment!
Â
Flutter Open One other App Video Playlist :
Discover the curated playlist for Flutter App to App Navigation defined in detailed with steps defined.
Â
predominant.dart :
Let’s begin with imports
import ‘dart:io’;
import ‘package deal:flutter/materials.dart’;
import ‘package deal:url_launcher/url_launcher.dart’;
Â
then create a predominant operate to start out this system
void predominant(){
runApp(MyApp());
}
Â
Now comes the vital facet i.e., launching app or redirecting to Playstore / Appstore if app is just not put in on system.
This performance is curated in a separate stand alone operate such that it may be simply re-used by means of out the app.
Right here you possibly can observe this operate will settle for a url that may be native or a ul the place app is situated.
void _launchApp(String url) async{
if(await canLaunchUrl(Uri.parse(url))){
await launchUrl(Uri.parse(url));
}else if(Platform.isIOS){
_launchApp(“https://apps.apple.com/app/id544007664”);
}else if(Platform.isAndroid){
_launchApp(“https://play.google.com/retailer/apps/particulars?id=com.Abhishekapps.abhishek.VoicetoText”);
}
}
Â
Add a appBar
appBar: AppBar(title: const Textual content(“First App”),),
Â
Add a primary performance to make a button click on occasion such that we’re capable of transfer to a second app.
Middle(
little one: ElevatedButton(
onPressed: () {
_launchApp(“amplifyabhi://launch”);
},
little one: const Textual content(“Navigate to One other App”),
),
),
Â
Full Code :
import ‘dart:io’;
import ‘package deal:flutter/materials.dart’;
import ‘package deal:url_launcher/url_launcher.dart’;
void predominant(){
runApp(MyApp());
}
class MyApp extends StatelessWidget {
void _launchApp(String url) async{
if(await canLaunchUrl(Uri.parse(url))){
await launchUrl(Uri.parse(url));
}else if(Platform.isIOS){
_launchApp(“https://apps.apple.com/app/id544007664”);
}else if(Platform.isAndroid){
_launchApp(“https://play.google.com/retailer/apps/particulars?id=com.Abhishekapps.abhishek.VoicetoText”);
}
}
const MyApp({tremendous.key});
@override
Widget construct(BuildContext context) {
return MaterialApp(
residence: Scaffold(
appBar: AppBar(title: const Textual content(“First App”),),
physique: Middle(
little one: ElevatedButton(
onPressed: (){
_launchApp(“amplifyabhi://launch”);
},
little one: const Textual content(“Navigate to second app”),
),
),
),
);
}
}
Â
You probably have any questions, be at liberty to drop them within the feedback under. For those who loved this tutorial, present us some love by liking and sharing for extra thrilling updates
Â