I am building flutter app with local json file, my json looks like
[
{
"category": "ملابس",
"count": 1,
"description": "ملابس رجالي",
"reference": "",
"color": "أحمر "
}
]
I need the user to find the product when he/she search e.g color, if the user search exactly 'أحمر' its works fine, but if the entered value was 'احمر' the condtion will be false so there is nothing appear in the list.
search function
Future<void> searchJson(query) async {
final jsondata = await rootBundle.loadString('assets/json/product.json');
final list = await json.decode(jsondata) as List<dynamic>;
List data = list
.where((map) => map['color']
.replaceAll(RegExp(String.fromCharCodes(arabicTashkelChar)), "")
.contains(query))
.toList();
setState(() {
items = data;
});
}
and here here is my arabicTashkelChar list for special Arabic character
const Iterable<int> arabicTashkelChar = [
1617,
124,
1614,
124,
1611,
124,
1615,
124,
1612,
124,
1616,
124,
1613,
124,
1618,
625,
627,
655,
];
I used arabicTashkelChar to make the string like this 'اللغَةُ الْعَرَبِيَّة' to this 'اللغة العربية'.
I don't have any problem with arabicTashkelChar its works fine my problem only with Alif (أ إ آ).
Now I want to make string like 'أحمر' to 'احمر' Also 'آ أ إ ' to 'ا' how to achieve this thing?