我正在尝试在我的应用程序中使用颤振沼泽。所以在创建列之后:
import 'package:moor_flutter/moor_flutter.dart';
@DataClassName("LocationTable")
class LocationTables extends Table {
TextColumn get locationUuid => text()();
RealColumn get latitude => real()();
现在我想将 locationUuid 作为索引。所以根据它的官方网站,我创建了一个 moor 文件来添加索引:
CREATE INDEX location_uuid_index ON LocationTables (locationUuid);
之后我在 db calss 中添加了这个文件:
@UseMoor(include: {
'index.moor'
}, tables: [
UserTables,
LocationTables,
], daos: [
UserDao,
])
class Database extends _$Database {
但是在运行构建运行器之后:
pub run build_runner build --delete-conflicting-outputs
我得到了这个错误:
[WARNING] moor_generator:moor_generator on lib/database/database.dart:
line 3, column 37: Target table LocationTables could not be found.
╷
3 │ CREATE INDEX location_uuid_index ON LocationTables (locationUuid);