-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use Uint8List instead of List<int> #37
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I think we should also change allocateBytes
to only accept an Uint8List
. Currently it copies the data it gets to a new Uint8List
, we can avoid that copy if we get an Uint8List
in the first place.
@@ -69,6 +69,8 @@ extension ValueUtils on Pointer<sqlite3_value> { | |||
} | |||
} | |||
|
|||
final utf8Encode = utf8.encoder.convert; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should only define this once, the usage in memory.dart
can just import this one.
sqlite3/lib/src/api/functions.dart
Outdated
@@ -3,7 +3,7 @@ import 'package:meta/meta.dart'; | |||
/// A scalar function exposed to sql. | |||
/// | |||
/// {@template sqlite3_function_behavior} | |||
/// The function must either return a `bool`, `num`, `String`, `List<int>` or | |||
/// The function must either return a `bool`, `num`, `String`, `Uint8List` or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should force users to return a Uint8List
here. It's a breaking change which IMO is not necessary. Most users return a Uint8List
already, I don't see much value in an enforcement in the type system.
We can check if we got an Uint8List
and implicitly copy to an Uint8List
if we didn't.
#36