diff --git a/lib/pgvector.dart b/lib/pgvector.dart index 70df0a0..980a3d6 100644 --- a/lib/pgvector.dart +++ b/lib/pgvector.dart @@ -21,8 +21,7 @@ class Pgvector { if (input is String) { input = Uint8List.fromList(utf8.encode(input)); } - var bdata = new ByteData.view(input.buffer, input.offsetInBytes); - return Vector.fromBinary(bdata).toList(); + return Vector.fromBinary(input).toList(); } } diff --git a/lib/vector.dart b/lib/vector.dart index eb84d59..41258e7 100644 --- a/lib/vector.dart +++ b/lib/vector.dart @@ -5,7 +5,8 @@ class Vector { const Vector(this.vec); - factory Vector.fromBinary(ByteData bdata) { + factory Vector.fromBinary(Uint8List bytes) { + var bdata = new ByteData.view(bytes.buffer, bytes.offsetInBytes); var dim = bdata.getUint16(0); var unused = bdata.getUint16(2); if (unused != 0) {