use Uint8List instead of list<int>
see https://medium.com/flutter-community/working-with-bytes-in-dart-6ece83455721
Can you please be more specific on what the issue is? This package uses Uint8List internally all the time, and sqlite blobs are returned as Uint8List as well.
see the image below , i means function return Uint8List instead of list
Hi @simolus3 what is the status here? Are you open for PRs?
I still don't really see the problem here.
Whenever this package reports data from sqlite3, say because it's reading a BLOB column or because a BLOB value is passed to a user-defined function, it is already exporting the data as Uint8List.
For data that is passed from Dart to sqlite3, we accept List<int>'s in general. As Uint8List implements List<int>, you can already use Uint8Lists to bind blob values to prepared statements. There way we allocate a List<int> as a native pointer is this:
https://github.com/simolus3/sqlite3.dart/blob/2ffd871606e0f43f68f1364d8f4e1428dcbf3792/sqlite3/lib/src/ffi/memory.dart#L34-L42
setAll will check if the argument passed is a Uint8List and does a memcpy in that case, so I expect no overhead of us accepting a general List<int>. The other way around is much more important, and we're consistently using Uint8Lists there. Again, you can also pass Uint8Lists to this package without issue.
In the future, there might be a way in Dart to pass Uint8Lists to C without copying - then there's a benefit of only accepting them. But we can still do an is check to determine whether to share the buffer or whether it needs to be copied.
Thank you for the fast response. I was able to pin the issue to a faulty conversion within our code. I must have gotten a bit confused when initially debugging our issue.
Sorry for the noise