Use DexDiffer to perform a structural comparison between two parsed DEX files. The differ uses full index remapping to handle string table reordering (e.g., caused by different build paths).
Check the isSafe property of the result to determine if the differences are non-breaking (such as source_file attributes or debug_info offsets). If isSafe is false, use describe() to get a description of the differences.
import 'package:dex/dex.dart';
const parser = DexParser();
final oldDex = parser.parse(oldBytes);
final newDex = parser.parse(newBytes);
final result = const DexDiffer().diff(oldDex, newDex);
if (result.isSafe) {
print('Only safe differences (e.g. source file paths)');
} else {
print(result.describe());
}