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 Aug 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status tool failures using:

  • Dart: 2.0.0
  • pana: 0.11.8
  • Flutter: 0.5.7

Platforms

Detected platforms: unsure

Error(s) prevent platform classification:

Make sure flutter format runs.

Issues and suggestions

Make sure flutter format runs.

Running flutter format failed with the following output:

Exception: dartfmt on lib/ failed with exit code 65
Could not format because the source could not be parsed:

line 32, column 13 of lib/android_app_info.dart: Expected to find ')'.
      await _channel.invokeMethod('get-data', {"name": name}));
            ^^^^^^^^
line 32, column 13 of lib/android_app_info.dart: Expected to find ';'.
      await _channel.invokeMethod('get-data', {"name": name}));
            ^
line 32, column 35 of lib/android_app_info.dart: Expected an identifier.

Fix lib/android_app_info.dart.

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.

Fix platform conflicts.

Error(s) prevent platform classification:

Make sure flutter format runs.

Running dartdoc failed.

Make sure dartdoc runs without any issues.

Maintain CHANGELOG.md.

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

Add SDK constraint in pubspec.yaml.

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

Maintain README.md.

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

Package is pre-v1 release.

While there is nothing inherently wrong with versions of 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.6 1.14.11
meta 1.1.5 1.1.6
sky_engine 0.0.99
typed_data 1.1.5 1.1.6
vector_math 2.0.6 2.0.8