apps_list 0.0.1 copy "apps_list: ^0.0.1" to clipboard
apps_list: ^0.0.1 copied to clipboard

Flutter plugin to query for android launchable apps.

example/lib/main.dart

import 'package:apps_list/app_info.dart';
import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:apps_list/apps_list.dart';

void main() {
  runApp(const MyApp());
}

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

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

class _MyAppState extends State<MyApp> {
  final _appsListPlugin = AppsList();
  List<AppInfoByProfile> _apps = [];

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  Future<void> initPlatformState() async {
    List<AppInfoByProfile> apps = [];
    try {
      apps = await _appsListPlugin.getInstalledApps();
    } on PlatformException {
      throw Exception("Failed to get apps");
    }

    if (!mounted) return;

    setState(() {
      _apps = apps;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('App List Example'),
        ),
        body: ListView.builder(
          itemCount: _apps.length,
          itemBuilder: (context, index) {
            final application = _apps[index];
            return ListTile(
              leading: Image.memory(application.icon),
              title: Text(application.name),
              subtitle: Text(
                  "${application.packageName} ${application.serialNumber} ${application.profile}"),
              onTap: () => _appsListPlugin.launchApp(
                  application.packageName, application.serialNumber),
            );
          },
        ),
      ),
    );
  }
}
1
likes
0
points
50
downloads

Publisher

verified publisherkipruto.dev

Weekly Downloads

Flutter plugin to query for android launchable apps.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on apps_list