my_uninstall_plugin 0.0.2
my_uninstall_plugin: ^0.0.2 copied to clipboard
A simple package to check if an application has been uninstalled, returning a boolean value.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:my_uninstall_plugin/my_uninstall_plugin.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {
final bool success =
await MyUninstallPlugin.uninstallApp("com.transsion.carlcare");
if (success) {
print("Uninstall success");
} else {
print("Uninstall failed");
}
}
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: TextButton(
child: Text("Uninstall"),
onPressed: () {
initPlatformState();
},
),
),
),
);
}
}