device_apps_repair 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 44

###statement First, mark the original author of the plug-in´╝îAuthor: Edouard Marquez Uploader moi@edouard-marquez.me

Flutter Device apps repair plugin #

Plugin to get the list of installed applications (iOS is not supported yet).

Getting Started #

First, you have to import the package in your dart files with:

import 'package:device_apps/device_apps.dart';

List of installed applications #

To get the list of the apps installed on the device:

List<Application> apps = await DeviceApps.getInstalledApplications();

You can filter system apps if necessary. Note: The list of apps is not ordered!

Get apps with launch intent #

You can now get only those apps with launch intent by using the following option. Also add includeSystemApps option to get all the apps that have launch intent.

// Returns a list of only those apps that have launch intent
// The main thing is to modify this place.
List<ApplicationWithIcon> apps = await DeviceApps.getInstalledApplications(onlyAppsWithLaunchIntent: true, includeSystemApps: true)

Get an application #

To get a specific app by package name:

Application app = await DeviceApps.getApp('com.frandroid.app');

Check if an application is installed #

To check if an app is installed (via its package name):

bool isInstalled = await DeviceApps.isAppInstalled('com.frandroid.app');

Open an application #

To open an application

DeviceApps.openApp('com.frandroid.app');

Displaying app icon #

When calling the getInstalledApplications() or getApp() methods, you can ask for the icon. To display the image, just call:

//uint8list  Type
Image.memory(app.icon);

0.0.1 #

  • TODO: Describe initial release.

example/lib/main.dart

import 'package:device_apps_repair/device_apps_repair.dart';
import 'package:flutter/material.dart';

void main() => runApp(MaterialApp(home: ListAppsPages()));

class ListAppsPages extends StatefulWidget {
  @override
  _ListAppsPagesState createState() => _ListAppsPagesState();
}

class _ListAppsPagesState extends State<ListAppsPages> {
  bool _showSystemApps = false;
  bool _onlyLaunchableApps = false;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Installed applications"),
        actions: <Widget>[
          PopupMenuButton(
            itemBuilder: (context) {
              return <PopupMenuItem<String>>[
                PopupMenuItem<String>(
                    value: 'system_apps', child: Text('Toggle system apps')),
                PopupMenuItem<String>(
                  value: "launchable_apps", child: Text('Toggle launchable apps only'),
                )
              ];
            },
            onSelected: (key) {
              if (key == "system_apps") {
                setState(() {
                  _showSystemApps = !_showSystemApps;
                });
              }
              if(key == "launchable_apps"){
                setState(() {
                  _onlyLaunchableApps = !_onlyLaunchableApps;
                });
              }
            },
          )
        ],
      ),
      body: _ListAppsPagesContent(
          includeSystemApps: _showSystemApps, onlyAppsWithLaunchIntent: _onlyLaunchableApps, key: GlobalKey()),
    );
  }
}

class _ListAppsPagesContent extends StatelessWidget {
  final bool includeSystemApps;
  final bool onlyAppsWithLaunchIntent;

  const _ListAppsPagesContent({Key key, this.includeSystemApps: false, this.onlyAppsWithLaunchIntent: false})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return FutureBuilder(
        future: DeviceApps.getInstalledApplications(
            includeAppIcons: true, includeSystemApps: includeSystemApps, onlyAppsWithLaunchIntent: onlyAppsWithLaunchIntent),
        builder: (context, data) {
          if (data.data == null) {
            return Center(child: CircularProgressIndicator());
          } else {
            List<Application> apps = data.data;
            print(apps);
            return ListView.builder(
                itemBuilder: (context, position) {
                  Application app = apps[position];
                  return Column(
                    children: <Widget>[
                      ListTile(
                          leading: app is ApplicationWithIcon
                              ? CircleAvatar(
                            backgroundImage: MemoryImage(app.icon),
                            backgroundColor: Colors.white,
                          )
                              : null,
                          onTap: () => DeviceApps.openApp(app.packageName),
                          title: Text("${app.appName} (${app.packageName})"),
                          subtitle: Text(
                              "Version: ${app.versionName}\nSystem app: ${app.systemApp}\nData dir : ${app.dataDir}")),
                      Divider(
                        height: 1.0,
                      )
                    ],
                  );
                },
                itemCount: apps.length);
          }
        });
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  device_apps_repair: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:device_apps_repair/device_apps_repair.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
75
Overall:
Weighted score of the above. [more]
44
Learn more about scoring.

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.9+1
  • Flutter: 1.17.3

Analysis suggestions

Package does not support Flutter platform linux

Because of import path [package:device_apps_repair/device_apps_repair.dart]

Package does not support Flutter platform macos

Because of import path [package:device_apps_repair/device_apps_repair.dart]

Package does not support Flutter platform web

Because of import path [package:device_apps_repair/device_apps_repair.dart]

Package does not support Flutter platform windows

Because of import path [package:device_apps_repair/device_apps_repair.dart]

Package not compatible with SDK dart

because of import path [device_apps_repair]

Health issues and suggestions

Document public APIs. (-1 points)

16 out of 16 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/device_apps_repair.dart. (-1 points)

Analysis of lib/device_apps_repair.dart reported 2 hints:

line 18 col 13: This function has a return type of 'List

line 52 col 13: This function has a return type of 'Application', but doesn't end with a return statement.

Maintenance suggestions

Package is getting outdated. (-25.48 points)

The package was last published 65 weeks ago.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.0
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies
flutter_test