version_tracking 1.0.1+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 62

VersionTracking for Flutter #

pub package

Introduction #

This is pretty much as copy/paste job from the Xamarin folks with a few adjustments to make things work for Flutter.

Documentation #

docs.microsoft.com/xamarin/essentials/version-tracking

Usage #

The Xamarin.Essentials VersionTracking requires calling Track() each time the application runs, in the Flutter version, calling the constructor from accomplishes the same thing.

void main() {
    SharedPreferences.getInstance().then((sharedPreferences) {
        PackageInfo.fromPlatform().then((packageInfo) {
            runApp(MyApp(
                versionTracking: VersionTracking.from(
                    sharedPreferences: sharedPreferences,
                    packageInfo: packageInfo
                )
            ));
        });
    });
}

class MyApp extends StatelessWidget {
    MyApp({this.versionTrackings});

    final VersionTracking versionTracking;
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

1.0.0 #

  • Initial version, created by Stagehand

1.0.1 #

  • Changed VersionTracking.from constructor argument names.

example/main.dart

import 'package:flutter/material.dart';
import 'package:package_info/package_info.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:version_tracking/version_tracking.dart';

void main() async {

  var preferences = await SharedPreferences.getInstance();
  var info = await PackageInfo.fromPlatform();

  runApp(MyApp(
    versionTracking: VersionTracking.from(sharedPreferences: preferences, packageInfo: info),
  ));
} 

class MyApp extends StatelessWidget {

  const MyApp({this.versionTracking});
  
  final VersionTracking versionTracking;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        body: Center(
          child: Column(
            children: <Widget>[
              Text(versionTracking.toString())
            ],
          )
        )
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  version_tracking: ^1.0.1+1

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:version_tracking/version_tracking.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
32
Health:
Code health derived from static analysis. [more]
95
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
87
Overall:
Weighted score of the above. [more]
62
Learn more about scoring.

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

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/version_tracking.dart. (-4.89 points)

Analysis of lib/version_tracking.dart reported 10 hints, including:

line 30 col 74: Avoid empty statements.

line 125 col 49: Avoid using braces in interpolation when not needed.

line 126 col 49: Avoid using braces in interpolation when not needed.

line 127 col 49: Avoid using braces in interpolation when not needed.

line 129 col 49: Avoid using braces in interpolation when not needed.

Maintenance suggestions

The package description is too short. (-13 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
package_info ^0.4.0+5 0.4.0+9
shared_preferences ^0.5.3+4 0.5.3+5
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_driver
flutter_test
test any