getScientificNameByImage method

Future<String?> getScientificNameByImage(
  1. String imagePath
)

Implementation

Future<String?> getScientificNameByImage(String imagePath) async {
  final db = await database;
  final fileName = imagePath.split('/').last;

  final result = await db.rawQuery(
      "SELECT scientificName FROM species WHERE img_general LIKE '%$fileName%' LIMIT 1");

  return result.isNotEmpty ? result.first['scientificName'] as String? : null;
}