zeba_academy_math 1.0.0 copy "zeba_academy_math: ^1.0.0" to clipboard
zeba_academy_math: ^1.0.0 copied to clipboard

A lightweight Dart mathematical utility package with arithmetic helpers, interpolation, percentages, rounding, and random utilities.

zeba_academy_math #

A lightweight and powerful Dart/Flutter mathematical utility package providing common mathematical helpers including arithmetic operations, clamping, interpolation, averages, percentages, rounding, and random number generation.

pub package license Flutter

Features #

✨ Simple arithmetic helpers ✨ Value clamping utilities ✨ Linear interpolation support ✨ Average calculations ✨ Percentage calculations ✨ Number rounding helpers ✨ Random integer and decimal generation ✨ Min / Max helpers ✨ Number checking utilities ✨ Lightweight and dependency-free

Installation #

Add this package to your pubspec.yaml:

dependencies:
  zeba_academy_math: ^1.0.0

Then run:

flutter pub get

Import #

import 'package:zeba_academy_math/zeba_academy_math.dart';

Usage #

Arithmetic Helpers #

Perform common mathematical operations.

ZebaMathArithmetic.add(10, 20);
// 30


ZebaMathArithmetic.subtract(50, 20);
// 30


ZebaMathArithmetic.multiply(5, 5);
// 25


ZebaMathArithmetic.divide(100, 4);
// 25

Power Calculation #

ZebaMathArithmetic.power(2, 3);

// 8

Clamp Values #

Keep numbers within a specific range.

ZebaClamp.clamp(
 150,
 0,
 100,
);

// Output:
// 100

Example:

ZebaClamp.clamp(
50,
0,
100,
);

// Output:
// 50

Linear Interpolation #

Interpolate smoothly between two values.

ZebaInterpolation.lerp(
0,
100,
0.5,
);

// Output:
// 50

Useful for:

  • Animations
  • Progress calculations
  • Position transitions

Average Calculation #

Calculate average values easily.

ZebaAverage.calculate(
[
10,
20,
30,
]
);

// Output:
// 20

Percentage Helpers #

Calculate Percentage #

ZebaPercentage.calculate(
25,
100,
);

// Output:
// 25

Calculate Value From Percentage #

ZebaPercentage.of(
20,
500,
);

// Output:
// 100

Rounding Utilities #

Round Decimal Values #

ZebaRounding.round(
12.34567,
2,
);

// Output:
// 12.35

Floor #

ZebaRounding.floor(
10.8,
);

// Output:
// 10

Ceiling #

ZebaRounding.ceil(
10.2,
);

// Output:
// 11

Random Number Generation #

Random Integer #

ZebaRandom.integer(
1,
100,
);

Generates a random number between 1 and 100.

Random Double #

ZebaRandom.doubleValue(
1.0,
10.0,
);

Math Helpers #

Maximum Value #

ZebaMathHelpers.max(
10,
20,
);

// Output:
// 20

Minimum Value #

ZebaMathHelpers.min(
10,
20,
);

// Output:
// 10

Check Even Number #

ZebaMathHelpers.isEven(
4,
);

// true

Check Odd Number #

ZebaMathHelpers.isOdd(
5,
);

// true

Why zeba_academy_math? #

Many Flutter applications require small mathematical operations repeatedly.

Instead of rewriting common logic, this package provides:

✅ Clean APIs ✅ Reusable utilities ✅ No external dependencies ✅ Easy integration ✅ Production-friendly Dart code

Example #

import 'package:zeba_academy_math/zeba_academy_math.dart';


void main(){

print(
 ZebaMathArithmetic.add(
 10,
 20,
 )
);


print(
 ZebaPercentage.calculate(
 50,
 200,
 )
);


print(
 ZebaRandom.integer(
 1,
 100,
 )
);

}

Roadmap #

Future improvements may include:

  • Advanced mathematical functions
  • Statistics helpers
  • Geometry utilities
  • Trigonometry helpers
  • Financial calculations
  • More extension methods

Contributing #

Contributions are welcome!

Steps:

  1. Fork the repository
  2. Create a new branch
  3. Add your improvements
  4. Commit changes
  5. Create a Pull Request

About Me #

✨ I’m Sufyan bin Uzayr, an open-source developer passionate about building and sharing meaningful projects.

You can learn more about me and my work at:

sufyanism.com

or connect with me on:

LinkedIn

Your all-in-one learning hub! #

🚀 Explore courses and resources in coding, tech, and development at:

Empower yourself with practical skills through curated tutorials, real-world projects, and hands-on experience.

Level up your tech game today! 💻✨

Zeba Academy #

Zeba Academy is a learning platform dedicated to coding, technology, and development.

➡ Visit our main site:

https://zeba.academy

➡ Explore hands-on courses and resources:

https://code.zeba.academy

➡ Check out our YouTube tutorials:

https://www.youtube.com/@zeba.academy

➡ Follow us on Instagram:

https://www.instagram.com/zeba.academy/

Thank you for visiting!

License #

This project is licensed under the GNU General Public License v3.0 (GPL-3.0).

You are free to:

  • Use this software
  • Study the source code
  • Modify the software
  • Share improvements

See the full license:

https://www.gnu.org/licenses/gpl-3.0.html

0
likes
140
points
88
downloads

Documentation

API reference

Publisher

verified publisherzeba.academy

Weekly Downloads

A lightweight Dart mathematical utility package with arithmetic helpers, interpolation, percentages, rounding, and random utilities.

Homepage

License

GPL-3.0 (license)

Dependencies

flutter

More

Packages that depend on zeba_academy_math