my_math 0.0.2 copy "my_math: ^0.0.2" to clipboard
my_math: ^0.0.2 copied to clipboard

A simple Dart/Flutter package providing basic math operations such as addition, subtraction, multiplication, and division.

example/main.dart

import 'package:my_math/my_math.dart';

void main() {
  final math = MyMath();

  int a = 10;
  int b = 5;

  print('Add: ${math.add(a, b)}'); // Output: Add: 15
  print('Subtract: ${math.subtract(a, b)}'); // Output: Subtract: 5
  print('Multiply: ${math.multiply(a, b)}'); // Output: Multiply: 50
  print('Divide: ${math.divide(a, b)}'); // Output: Divide: 2.0

  try {
    print('Divide by zero: ${math.divide(a, 0)}'); // This will throw an error
  } catch (e) {
    print('Error: $e'); // Output: Error: Cannot divide by zero
  }
}
2
likes
135
points
12
downloads

Publisher

unverified uploader

Weekly Downloads

A simple Dart/Flutter package providing basic math operations such as addition, subtraction, multiplication, and division.

Documentation

API reference

License

unknown (license)

Dependencies

flutter

More

Packages that depend on my_math