flutter clean
+ flutter pub get
but same thing.@GP4cK It sounds like you may have to update your ref
on your encrypted_moor
git dependency? If you have a hardcoded commit or tag that might not work as expected.
Also, I see that there is now also an encrypted version of moor/ffi. What's the difference?
Basically, it lets you use the regular moor/ffi
library with libsqlcipher
(instead of libsqlite3
) underneath. It's a relationship similar to moor_flutter
vs. moor/ffi
(one of them uses platform channels, one of them uses dart:ffi
to call the native library directly.
@simolus3 from my pubspec I have this:
dependencies:
moor: ^3.3.1
encrypted_moor:
git:
url: https://github.com/simolus3/moor.git
path: extras/encryption
dependency_overrides:
# See install instructions of https://pub.dev/packages/sqflite_sqlcipher
sqflite:
git:
url: https://www.github.com/davidmartos96/sqflite_sqlcipher.git
path: sqflite
ref: fmdb_override
So no reference to any commit... But ok I'll investigate a bit more
writes
are significantly slower after I switched to the encrypted version
pub get
. Can you try deleting the encrypted_moor
folders in ~/.pub-cache/git
?
toJson()
methods on the companion classes?extension
on all the companion class to add this toJson() method but it would be super nice if moor could do it for me :)
Hi – I was wondering if it is possible to do non-literal customConstraints – i.e:
@override
List<String> get customConstraints => [
'FOREIGN KEY(${table}_entity_id, ${table}_valid_from) REFERENCES ${table}(entity_id, valid_from)',
];
Or perhaps even
@override
List<String> get customConstraints => [
...constraintsFromMixinA,
...constraintsFromMixinB,
];
@davidmartos96 thanks – knowing returning *
is on the roadmap is great news.
I guess I can probably just use
final rowId = await _db.into(todos).insert(record);
customSelect(
'SELECT * FROM todos WHERE rowid = ?',
variables: [Variable.withInt(rowId)],
readsFrom: {todos},
);
Hello, @simolus3 .
I'm not sure, probably it's late, my code is broken, but for me those two functions seems to be controversal:
@override
Uint8List? mapFromDatabaseResponse(dynamic response) {
return response as String?;
}
@override
String mapToSqlConstant(Uint8List? content) {
if (content == null) return 'NULL';
// BLOB literals are string literals containing hexadecimal data and
// preceded by a single "x" or "X" character. Example: X'53514C697465'
return "x'${hex.encode(content)}'";
}
When I put a 16 uint8 values to db I get back 32.
Why do we use mapping to put to db and do not to get back?
Sorry if I missed something, didn't have a chance to look deeper and try on a clean project
INTEGER PRIMARY KEY
. That generates a nullable id in the moor DataClass. Shouldn't it be non null? Integer primary keys get assigned an id automatically when inserted with null, but for that we have the companions, or not?