android_app_info 0.0.4

  • Example
  • Installing
  • Versions
  • 0

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 packages get

Alternatively, your editor might support pub get or flutter packages 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';
  
Version Uploaded Documentation Archive
0.0.4 Aug 17, 2017 Go to the documentation of android_app_info 0.0.4 Download android_app_info 0.0.4 archive
0.0.3 Aug 16, 2017 Go to the documentation of android_app_info 0.0.3 Download android_app_info 0.0.3 archive
0.0.2 Aug 3, 2017 Go to the documentation of android_app_info 0.0.2 Download android_app_info 0.0.2 archive
0.0.1 Aug 3, 2017 Go to the documentation of android_app_info 0.0.1 Download android_app_info 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
0
Learn more about scoring.

We analyzed this package on Oct 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.4
  • Flutter: 0.9.5

Platforms

Detected platforms: unsure

Error(s) prevent platform classification:

Error(s) in lib/android_app_info.dart: 'name' isn't a field in the enclosing class.

Health issues and suggestions

Fix lib/android_app_info.dart. (-100 points)

Analysis of lib/android_app_info.dart failed with 37 errors, 5 warnings, including:

line 14 col 5: 'name' isn't a field in the enclosing class.

line 15 col 5: 'packageName' isn't a field in the enclosing class.

line 16 col 5: 'className' isn't a field in the enclosing class.

line 17 col 5: 'dataDir' isn't a field in the enclosing class.

line 18 col 5: 'label' isn't a field in the enclosing class.

Maintenance issues and suggestions

Fix platform conflicts. (-20 points)

Error(s) prevent platform classification:

Error(s) in lib/android_app_info.dart: 'name' isn't a field in the enclosing class.

Running dartdoc failed. (-10 points)

Make sure dartdoc runs without any issues.

Maintain README.md. (-30 points)

Readme should inform others about your project, what it does, and how they can use it.

Maintain CHANGELOG.md. (-20 points)

Changelog entries help clients to follow the progress in your code.

Add SDK constraint in pubspec.yaml. (-5 points)

For information about setting SDK constraint, please see https://www.dartlang.org/tools/pub/pubspec#sdk-constraints.

Package is getting outdated. (-14.52 points)

The package was released 59 weeks ago.

Package is pre-v0.1 release. (-10 points)

While there is nothing inherently wrong with versions of 0.0.*, it usually means that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8