formatPriceToFirestore function

int formatPriceToFirestore(
  1. String price
)

Implementation

int formatPriceToFirestore(String price){

  /*
  final priceNoCharacter = price.replaceAll("R\$ ", "");
  final priceNoComma = priceNoCharacter.replaceAll(",", "");
  final priceNoPoint = priceNoComma.replaceAll(".", "");
   */

  final newPrice = price.substring(2, price.length).replaceAll(",", "").replaceAll(".", "");

  //print(newPrice);

  return int.tryParse(newPrice) ?? 0;

}