setValue method

  1. @override
void setValue(
  1. Map<String, dynamic> values
)
override

Recebe um map e preencher o input. Pesquise o valor de acordo com a key do metood get name

Implementation

@override
void setValue(Map<String, dynamic> values) {
  String? valor = values[name]?.toString();
  if (valor != null && inputType == InputType.date) {
    valor = valor.split('-').reversed.join("/");
  }
  controller.text = ((valor) ?? valorinicial ?? "");
  if (inputType == InputType.currency && controller.text.isNotEmpty) {
    String valorFormatado = NumberFormat.currency(locale: 'pt_BR', symbol: '')
        .format(double.parse(controller.text));
    controller.text = valorFormatado;
  }
  if (controller.text.isEmpty && isPrimaryKey) {
    controller.text = "-1";
  } else if (latext && controller.text.isNotEmpty) {
    controller.text = controller.text;
  }
}