android_app_info 0.0.4

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:android_app_info/android_app_info.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  List<AndroidAppInfo> _apps = [];

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

  initPlatformState() async {
    String platformVersion;
    try {
      platformVersion = await AndroidAppInfo.platformVersion;
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';
    }

    // THIS IS THE MAGIC
    // Grabs the list of avaiable application activities.
    // If you want the actual *applications*, try AndroidAppInfo.getInstalledApplications.
    // (They both return Future<List<AndroidAppInfo>>).
    var apps = await AndroidAppInfo.getAvailableActivities();

    if (!mounted)
      return;

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

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Plugin example app'),
        ),
        body: new ListView.builder(
          itemCount: _apps.length,
          itemBuilder: (BuildContext context, int index) {
            var app = _apps[index];
            return new ListTile(
              // For a full list of the properties on an AndroidAppInfo instance, see the source
              // app.icon is the app's icon
              // app.defaultIcon is the default application icon
              leading: new Image.memory(app.icon ?? app.defaultIcon),
              // obvious...
              title: new Text(app.label ?? app.name ?? 'Unknown'),
              // also obvious...
              subtitle: new Text('${app.packageName}'),
              onTap: () => app.start(),
            );
          },
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  android_app_info: ^0.0.4

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or 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:android_app_info/android_app_info.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
0
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://dart.dev/dart-2#migration.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.

Admin