save method

Future<bool> save()

Implementation

Future<bool> save() async {
  final UTerminalBrokerResponse? b = editing;
  if (b == null && (logoBase64.isNullOrEmpty() || sign1Base64.isNullOrEmpty())) {
    UToast.error(message: U.s.required);
    return false;
  }
  return await send(
    b == null
        ? UServices.terminal.createBroker(
            p: UTerminalBrokerCreateParams(
              tags: <int>[TagTerminalBroker.test.number],
              code: codeController.text.trim(),
              title: titleController.text.trim(),
              registrationNumber: registrationNumberController.text.trim(),
              nationalCode: nationalCodeController.text.trim(),
              representative: representativeController.text.trim(),
              address: addressController.text.trim(),
              postalCode: postalCodeController.text.trim(),
              phoneNumber: phoneNumberController.text.trim(),
              sign1Base64: sign1Base64!,
              sign1Owner: sign1OwnerController.text.trim(),
              sign2Base64: sign2Base64,
              sign2Owner: sign2OwnerController.text.trim().nullIfEmpty(),
              logoBase64: logoBase64!,
            ),
          )
        : UServices.terminal.updateBroker(
            p: UTerminalBrokerUpdateParams(
              id: b.id,
              code: codeController.text.trim(),
              title: titleController.text.trim(),
              registrationNumber: registrationNumberController.text.trim(),
              nationalCode: nationalCodeController.text.trim(),
              representative: representativeController.text.trim(),
              address: addressController.text.trim(),
              postalCode: postalCodeController.text.trim(),
              phoneNumber: phoneNumberController.text.trim(),
              sign1Base64: sign1Base64,
              sign1Owner: sign1OwnerController.text.trim(),
              sign2Base64: sign2Base64,
              sign2Owner: sign2OwnerController.text.trim(),
              logoBase64: logoBase64,
            ),
          ),
    read,
  ) !=
      null;
}