errorThrower function

void errorThrower(
  1. String response
)

Implementation

void errorThrower(String response){
  Map<String,dynamic> parsed = jsonDecode(response);
  if(parsed["error"] != null){
    throw response;
  }
}