dexBytesContainString function
Search raw DEX bytes for a UTF-8 needle (class descriptors often appear
as plain strings, e.g. Lio/flutter/plugins/GeneratedPluginRegistrant;).
Implementation
bool dexBytesContainString(List<int> dexBytes, String needle) {
if (needle.isEmpty) return false;
final n = needle.codeUnits;
if (n.length > dexBytes.length) return false;
outer:
for (var i = 0; i <= dexBytes.length - n.length; i++) {
for (var j = 0; j < n.length; j++) {
if (dexBytes[i + j] != n[j]) continue outer;
}
return true;
}
return false;
}