my_math 0.0.2
my_math: ^0.0.2 copied to clipboard
A simple Dart/Flutter package providing basic math operations such as addition, subtraction, multiplication, and division.
A lightweight Dart package providing simple arithmetic operations (addition, subtraction, multiplication, division) with an easy-to-use API. Ideal for educational projects or utility applications needing basic math functionality.
Features #
- Simple arithmetic operations:
- Addition: Add two integers.
- Subtraction: Subtract one integer from another.
- Multiplication: Multiply two integers.
- Division: Divide one integer by another, with error handling for division by zero.
- Easy-to-use API with clear method documentation.
- Lightweight and suitable for educational or utility purposes.
- Written in pure Dart, with no external dependencies.
Getting started #
To start using the package, add it to your pubspec.yaml dependencies and run flutter pub get or dart pub get.
Prerequisites #
- Dart SDK installed (2.12.0 or higher recommended)
- A Dart or Flutter project
Usage #
Basic usage #
Create an instance of MyMath and call its methods:
import 'package:my_math/my_math.dart';
void main() {
final math = MyMath();
print(math.add(2, 3)); // 5
print(math.subtract(7, 4)); // 3
print(math.multiply(6, 8)); // 48
print(math.divide(10, 2)); // 5.0
// Handling division by zero
try {
math.divide(5, 0);
} catch (e) {
print(e); // Output: Invalid argument(s): Cannot divide by zero
}
}
You can use these methods anywhere in your Dart or Flutter project to perform basic arithmetic operations.
Additional information #
For more information about the my_math package, visit the package page on pub.dev for documentation, changelogs, and updates.
Contributing #
Contributions are welcome! If you have suggestions for improvements or new features, feel free to open an issue or submit a pull request on the GitHub repository.
Reporting Issues #
If you encounter bugs or have questions, please file an issue on the GitHub repository. The maintainers aim to respond to issues within a few days.
Support #
For general questions or support, you can also start a discussion in the repository or reach out via the contact information provided on pub.dev.
Thank you for using my_math!