Flutter: how to read Arabic Text from API?

Issue Here’s my code: how I fetched data from the internet, using the package of HTTP and creating a model class Future<Iterable<SubCategories>> fetchCategories() async { final res = await http.post( Uri.parse(‘https://___________________’), ); final List<dynamic> responseJson = jsonDecode(res.body)["response"]; late Iterable<SubCategories> allCategories

Continue reading

codeUnits property vs utf8.encode function in Dart

Issue I have this little code: void main(List<String> args) { const data = ‘amigo+/=:chesu’; var encoded = base64Encode(utf8.encode(data)); var encoded2 = base64Encode(data.codeUnits); var decoded = utf8.decode(base64Decode(encoded)); var decoded2 = utf8.decode(base64Decode(encoded2)); print(encoded); print(encoded2); print(decoded); print(decoded2); } The output is: YW1pZ28rLz06Y2hlc3U= YW1pZ28rLz06Y2hlc3U=

Continue reading

codeUnits property vs utf8.encode function in Dart

Issue I have this little code: void main(List<String> args) { const data = ‘amigo+/=:chesu’; var encoded = base64Encode(utf8.encode(data)); var encoded2 = base64Encode(data.codeUnits); var decoded = utf8.decode(base64Decode(encoded)); var decoded2 = utf8.decode(base64Decode(encoded2)); print(encoded); print(encoded2); print(decoded); print(decoded2); } The output is: YW1pZ28rLz06Y2hlc3U= YW1pZ28rLz06Y2hlc3U=

Continue reading