carHandler function

PlateInfo carHandler(
  1. NormalizedPlate plate
)

Gives car's plate information from its normalized form of the plate

Implementation

PlateInfo carHandler(NormalizedPlate plate) {
  var provinceCode = int.parse(plate.numbers.substring(5, 7));
  var type = 'Car';
  var template = '${plate.numbers.substring(0, 2)}${plate.char}'
      '${plate.numbers.substring(2, 5)}ایران$provinceCode';
  var province = _getCarProvince(provinceCode);
  var category = _getCategory(plate.char ?? '');
  return PlateInfo(
    template: template,
    province: province,
    type: type,
    category: category,
  );
}