moving_average 0.1.0-alpha3

  • Readme
  • Changelog
  • Example
  • Installing
  • 69

A library for the calculation of moving averages.

Usage #

A simple usage example:

import 'package:moving_average/moving_average.dart';

main() {
  final values = [1, 2, 3, 4, 5];
  print("Values = $values");
  // Values = [1, 2, 3, 4, 5]

  final movingAverage3 = movingAverage(values, 3, includePartial: true);
  print("Moving Average, size 3, partial = $movingAverage3");
  // Moving Average, size 3, partial = [1.0, 1.5, 2.0, 3.0, 4.0]

  final weightedAverage3 = weightedMovingAverage(values, 3);
  print("Weighted Moving Average, size 3 = $weightedAverage3");
  // Weighted Moving Average, size 3 = [2.3333333333333335, 3.3333333333333335, 4.333333333333333]
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

0.1.0-alpha3 #

  • Use analysis_options from flutter repo
  • Update code to pass analysis

0.1.0-alpha2 #

  • Update package description

0.1.0-alpha #

example/moving_average_example.dart

import 'package:moving_average/moving_average.dart';

void main() {
  final List<num> values = <num>[1, 2, 3, 4, 5];
  print('Values = $values');

  print('\nSize = 2, includepartial = false');

  final List<num> movingAverage2 = movingAverage(values, 2);
  print('Moving Average, size 2 = $movingAverage2');

  final List<num> weightedAverage2 = weightedMovingAverage(values, 2);
  print('Weighted Moving Average, size 2 = $weightedAverage2');

  print('\nSize = 3, includepartial = true');

  final List<num> movingAverage3 =
      movingAverage(values, 3, includePartial: true);
  print('Moving Average, size 3 = $movingAverage3');

  final List<num> weightedAverage3 =
      weightedMovingAverage(values, 3, includePartial: true);
  print('Weighted Moving Average, size 3 = $weightedAverage3');
}

Use this package as a library

1. Depend on it

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


dependencies:
  moving_average: ^0.1.0-alpha3

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

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

  • Dart: 2.7.1
  • pana: 0.13.6

Maintenance suggestions

The package description is too short. (-14 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.

Package is pre-release. (-5 points)

Pre-release versions should be used with caution; their API can change in breaking ways.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.5.0 <3.0.0
Dev dependencies
pedantic ^1.9.0
test ^1.9.4