A most easily usable improvement rate calculator library in Dart!

1. About

ImprovementRate is an open-sourced Dart library.
With ImprovementRate, you can easily calculate improvement rate on your application.

Maybe you have looked up a formula or implemented similar steps when comparing data and calculating improvement rates. With this library, such research and implementation is no longer necessary!

The following formula is used to calculate the improvement rate.

When after value should be increased:

Rate = (after - before) / before × 100.0

When after value should be decreased:

Rate = -((after - before) / before × 100.0)

1.1. Introduction

1.1.1. Install Library

With Dart:

 dart pub add improvement_rate

With Flutter:

 flutter pub add improvement_rate

1.1.2. Import It

import 'package:improvement_rate/improvement_rate.dart';

1.1.3. Use ImprovementRate

import 'package:improvement_rate/improvement_rate.dart';

void main() {
  final calculator = Calculator.instance;

  final resultShouldBeDecreased = calculator.evaluate(
    before: 100,
    after: 37,
  );

  final resultShouldBeIncreased = calculator.evaluate(
    before: 100,
    after: 37,
    policy: ShouldBe.increased,
  );

  print(resultShouldBeDecreased);
  print(resultShouldBeIncreased);

  switch (resultShouldBeDecreased.trend) {
    case Trend.better:
      return;
    case Trend.worse:
      return;
  }
}

1.2. License

Copyright (c) 2021, Kato Shinya. All rights reserved.
Use of this source code is governed by a
BSD-style license that can be found in the LICENSE file.

1.3. More Information

ImprovementRate was designed and implemented by Kato Shinya.

GitHub

View Github