zam_core 0.1.1 zam_core: ^0.1.1 copied to clipboard
Core library for all zamstation packages which contains the most basic classes like the NamedException to get started.
Zam Core Library #
Core library for all the packages built by zamstation.
What's inside the package #
Check out all the components in detail here
How to use #
ParameterizedBuilder #
final ParameterizedBuilder<Type, Car> carBuilder;
// ...
final car = carBuilder(HondaCivic);
ParameterizedCallback #
final ParameterizedCallback<double, int> roundOffStrategy;
// ...
final price = roundOffStrategy(8.458);
NamedException #
Wrapper around the built-in Exception
class.
Provides more classified details of the exception like severity
and solution
.
Construct it with a simple problem statement.
final exception = NamedException('Provided value is -26 which is negative.');
or build it with more details.
final exception = NamedException(
'Provided value is -26 which is negative.'
solution: 'Please provide a positive value.'
severity: ExceptionSeverity.critical,
);
Cloneable #
class Triangle implements Cloneable<Triangle> {
final double base;
final double height;
const Triangle(this.base, this.height);
@override
Triangle clone() {
return Triangle(this.base, this.height);
}
}