feat(block1): bundled species catalog + autocomplete link

Add a small curated catalog of Iberian horticultural species and let a variety
be linked to it from the edit sheet.

- assets/catalog/species.json: 14 species with botanical family and ES/EN
  common names (wikidata_qid/gbif_key deferred to the varilla enrichment).
- SpeciesRepository: idempotent seedBundled (is_bundled rows, keyed by
  scientific name) + search by scientific/common name with a locale-best label.
  Seeded on startup from DI.
- VarietyRepository.linkSpecies: sets species_id and prefills category from the
  species' family when empty (never overwrites an existing category).
  VarietyDetail now carries the scientific name.
- Edit sheet gains a live species-search field; the detail view shows the
  scientific name (italic). i18n strings added (ES/EN).

Tests: catalog parse, idempotent seeding, search by scientific/common name,
linkSpecies prefill semantics, and a widget test for the autocomplete → link →
scientific-name-shown flow. Full suite: 32 passing, 0 skipped.
This commit is contained in:
vjrj 2026-07-07 21:21:59 +02:00
parent 7ff4e38a15
commit 4e8b8293e0
22 changed files with 700 additions and 47 deletions

View file

@ -19,13 +19,22 @@ void useSqlCipher() {
}
DynamicLibrary _openLinuxCipher() {
// The dev package ships `libsqlcipher.so`; the runtime package only the
// versioned `libsqlcipher.so.0`. Accept either.
try {
return DynamicLibrary.open('libsqlcipher.so');
} on ArgumentError {
return DynamicLibrary.open('libsqlcipher.so.0');
// The dev package ships the `libsqlcipher.so` symlink; runtime packages ship
// only a versioned name (`.so.0`, `.so.1`, ). Try them in turn.
const candidates = [
'libsqlcipher.so',
'libsqlcipher.so.1',
'libsqlcipher.so.0',
];
Object? lastError;
for (final name in candidates) {
try {
return DynamicLibrary.open(name);
} on ArgumentError catch (e) {
lastError = e;
}
}
throw StateError('Could not load SQLCipher (tried $candidates): $lastError');
}
/// Opens [file] as an encrypted database using the raw 256-bit [keyHex].