我无法加载.g.dart文件

时间:2020-04-08 05:01:34

标签: flutter

.g.dart文件未加载。 当我尝试使此代码正常工作时,始终没有生成URI的错误目标。请尝试运行将生成文件的生成器。并且此错误存在于许多文件中,但是每当我尝试分割某些.g.dart文件时,该错误都是相同的。

import 'package:moor_flutter/moor_flutter.dart';
    import '../app_database/app_database.dart';
    part 'account.g.dart';

    class Accounts extends Table {
      IntColumn get id => integer().autoIncrement()();

      TextColumn get name => text()();

      TextColumn get nameNepali => text()();

      RealColumn get amount => real().withDefault(Constant(0))();

      BoolColumn get isSystem => boolean().withDefault(Constant(false))();

      DateTimeColumn get createdDate =>
          dateTime().withDefault(currentDateAndTime)();

      DateTimeColumn get modifiedDate =>
          dateTime().withDefault(currentDateAndTime)();

      TextColumn get adminName => text()();

      IntColumn get serialNumber => integer()();

      IntColumn get accountCategoryId =>
          integer().customConstraint('REFERENCES account_categories(id)')();
    }

    @UseDao(tables: [Accounts])
    class AccountsDao extends DatabaseAccessor<AppDatabase>
        with _$AccountsDaoMixin {
      AccountsDao(AppDatabase db) : super(db);

      Future<double> getCurrentBalance() async {
        final row = await customSelectQuery(
          'SELECT SUM(amount) as currentBalance FROM accounts;',
        ).getSingle();
        return row.readDouble('currentBalance');
      }

    }```


0 个答案:

没有答案