I want to implement conditions in my existing app that a particular app is installed or not.
Conditions:
the first app is that which is I'm going to build
Second app that is required for run first app
- If the app is installed (Second app) then run
HomePage()
in the first app - If the app is not installed then show a pop-up or alert for install the app.
Root Code of the first app
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: Future.delayed(Duration(seconds: 2)),
builder: (context, AsyncSnapshot snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return MaterialApp(
home: Splash(),
debugShowCheckedModeBanner: false,
);
} else {
return StreamBuilder(
stream: Connectivity().onConnectivityChanged,
builder: (context, AsyncSnapshot<ConnectivityResult> snapshot) {
return snapshot.data == ConnectivityResult.mobile ||
snapshot.data == ConnectivityResult.wifi
? MaterialApp(
title: 'mFollower',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Homepage(),
debugShowCheckedModeBanner: false,
)
: NoInternet();
},
);
}
});
}
}