SingleData.only constructor
SingleData.only(
- num data, {
- String? id,
- dynamic x,
})
Implementation
SingleData.only(num data, {String? id, this.x}) {
if (data > 0) {
up = data;
down = 0;
} else {
up = 0;
down = data;
}
if (id != null && id.isNotEmpty) {
this.id = id;
} else {
this.id = const Uuid().v4().toString().replaceAll('-', '');
}
if (up < down) {
throw FlutterError('maxData must more than minData');
}
if (x != null) {
if (!(x is num || x is String)) {
throw FlutterError('x only support num or string');
}
}
}