native
native copied to clipboard
JArray.getRange() has thread-safety problem
Future<Uint8List> getIcon(String packageName) async {
final JArray<jbyte> jArray = await getIconFromAndroid(packageName);
// There is a thread safety issue with the following line of code,
return jArray.getRange(0, jArray.length).buffer.asUint8List();
}
multiple executions test(), the return value maybe incorrect.
Isolate.run(() async {
final icon = getIcon('package1'); // maybe incorret
});
Isolate.run(() async {
final icon = getIcon('package2'); // maybe incorret
});