get_apps 3.1.1 copy "get_apps: ^3.1.1" to clipboard
get_apps: ^3.1.1 copied to clipboard

PlatformAndroid

Flutter Plugin to get all installed apps on android.

get_apps #

Flutter Plugin to get all installed apps.

Important Note #

For now code is not organized due to some urgency on my side but soon the whole code will be refactored though the APIs will be working the same(most probably). For now I'm not very consistent with the way I make change but soon there will a defined way to make changes in this repo.

TODO #

  • ❌ Add comments to make the documentation better.
  • ❌ Valid Test Cases.
  • ❌ How about supporting other platforms too?
  • ❌ Adding a stream method to continuously listen all apps rather then fetching them again manually on add/remove events.
  • ✅ Add more details regarding apps, such as their version.
  • init should be called automatically if hasn't been called before, rather than showing an error.

Usage #

To use this plugin, add get_apps as a dependency in your pubspec.yaml file.

Example #

Here is how you can use this package

import 'package:flutter/material.dart';
import 'package:get_apps/get_apps.dart';
import 'package:get_apps/models.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  late Future<List<AppInfo>> userApps;

  @override
  void initState() {
    GetApps()
        .getAppInfo("com.android.chrome", shouldInitialize: false)
        .then((appInfo) {
          print("Chrome is installed on your device");
        })
        .onError((e, s) {
          print("Chrome is not installed on your device $e");
        });
    userApps = GetApps().getApps();
    GetApps().appActionReceiver().forEach((packageAction) {
      userApps = GetApps().getApps();
      setState(() {});
    });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Plugin example app')),
        body: FutureBuilder<List<AppInfo>>(
          future: userApps,
          builder: (context, snapshot) {
            if (snapshot.hasData) {
              final data = snapshot.requireData;
              return ListView(
                children:
                    data
                        .map(
                          (e) => ListTile(
                            leading: Image.memory(e.appIcon),
                            title: Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: [
                                Text(
                                  "AppName: ${e.appName}",
                                  maxLines: 1,
                                  overflow: TextOverflow.ellipsis,
                                ),
                                Text(
                                  "PackageName: ${e.appPackage}",
                                  maxLines: 1,
                                  overflow: TextOverflow.ellipsis,
                                ),
                                Text(
                                  "Version: v${e.versionName}",
                                  maxLines: 1,
                                  overflow: TextOverflow.ellipsis,
                                ),
                              ],
                            ),
                            subtitle: Text(e.description ?? ""),
                            onLongPress: () {
                              GetApps().getAppInfo(e.appPackage);
                            },
                            onTap: () {
                              GetApps().openApp(e.appPackage);
                            },
                          ),
                        )
                        .toList(),
              );
            }
            if (snapshot.hasError) {
              return Center(child: Text(snapshot.error.toString()));
            }
            return const Center(child: CircularProgressIndicator());
          },
        ),
      ),
    );
  }
}
copied to clipboard
3
likes
160
points
192
downloads

Publisher

unverified uploader

Weekly Downloads

2024.11.11 - 2025.10.06

Flutter Plugin to get all installed apps on android.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on get_apps

Packages that implement get_apps