Order constructor
Implementation
Order(
this.amount,
this.currency,
this.id,
this.description,
this.email,
) {
if (amount < 0) {
throw ArgumentError('Amount should be more than 0');
}
if (currency.length < 3) {
throw ArgumentError.value(currency, 'currency');
}
if (id.length == 0 || id.length > 1024) {
throw ArgumentError("id's length should be > 0 && <= 1024");
}
if (description.length == 0 || description.length > 1024) {
throw ArgumentError("description's length should be > 0 && <= 1024");
}
if (email != null &&
email!.isNotEmpty &&
!EmailValidator.validate(email!)) {
throw ArgumentError("email is not valid");
}
}