1
I have the following function that calculates and saves 2 data in my database, but I want to format kwhAparelho and totalAparelho in a way that does not cause periodic tithes and preferably this way ##,## or ##. ##, what’s the best way to do it?
void _calculoAparelho() {
double quantidade = double.parse(qtdControlled.text);
double horadia = double.parse(horadiaControlled.text);
double diames = double.parse(diamesControlled.text);
double potencia = double.parse(potenciaControlled.text);
double kwh = double.parse(controllerkwh.text);
// calculo kwh
double kwhAparelho = (potencia * horadia * diames * quantidade / 1000);
note.consumokwh = '$kwhAparelho';
// valor em reais
double totalAparelho = (kwhAparelho * kwh);
note.gasto = '$totalAparelho'; }