on-internet
← Community

What is the correct fast way to compare two `Uint8List`s' equality?

Stack Overflow ·

Given Uint8List a = ...; Uint8List b = ...; I want to compare whether their content are the same. Of course I can use listEquals in Flutter, or write down a naive loop like: for (int index = 0; index < a.length; index += 1) { if (a[index] != b[index]) return false; } However, given that Uint8List is quite a special array, and it is often quite big, I guess where there is a better (faster) approach to do so?

Comments

Sign in or sign up to comment and upvote.

No comments yet.