sample_package1
A sample Flutter package demonstrating a monorepo structure with internal packages.
This package provides advanced number and string utilities by bundling two internal packages:
number_adder and string_adder.
✨ Features
-
NumberAdder:
- Add two numbers or a list of numbers
- Add percentages, compound addition (financial calculations)
- Range sum, integer addition, precision handling
-
StringAdder:
- Concatenate, capitalize, and format strings
- Add prefixes/suffixes, delimiters, line breaks
- Safe concatenation with null handling
-
Composed Utilities:
- High-level APIs that combine number and string operations for common business/reporting tasks
🚀 Getting Started
Add this package to your pubspec.yaml:
dependencies:
sample_package1: ^0.0.1
Then run:
flutter pub get
🛠 Usage
Import the package:
import 'package:sample_package1/sample_package1.dart';
Example
void main() {
// Complex operation
final result = SamplePackage1.performComplexOperation(10.0, 20.0, 'hello', 'world');
print(result); // Result: 33.0 - Hello World
// Financial summary
final summary = SamplePackage1.calculateFinancialSummary([100.0, 200.0, 300.0], 'USD');
print(summary); // Total Amount: 315.00 USD
// Report generation
final report = SamplePackage1.createReport({
'values': [10.0, 20.0, 30.0],
'labels': ['test', 'demo', 'example']
});
print(report);
// Safe calculation with nulls
final safe = SamplePackage1.safeCalculation(null, 15.0, null, 'test');
print(safe); // Safe Result: 15.00 (Unknown test)
// Direct access to internal packages
final sum = NumberAdder.add(5.0, 3.0); // 8.0
final joined = StringAdder.add('foo', 'bar'); // foo bar
}
📦 Internal Packages
This package bundles the following internal packages for direct use:
You can use their APIs directly via:
import 'package:sample_package1/sample_package1.dart';
final sum = NumberAdder.addAll([1.0, 2.0, 3.0]);
final title = StringAdder.addAsTitle('hello', 'world');
📄 Example
See example/demo.dart for a full demo.
🤝 Contributing
Contributions are welcome!
- File issues or feature requests via the issue tracker.
- Pull requests are encouraged.
📢 Additional Information
- License: MIT
- For more info, see the internal package docs or contact the maintainers.