Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated code "parameter isn't a function or method and can't be invoked." #3251

Open
emreakcan opened this issue Sep 30, 2024 · 1 comment
Assignees
Labels
area-manager Related to the manager, exposing an easier to use interface

Comments

@emreakcan
Copy link

emreakcan commented Sep 30, 2024

Describe the bug

Code generation generates the following

  $$ShotTracingTableTableProcessedTableManager
      get InteractiveMapHolesTournamentId {
    final manager =
        $$ShotTracingTableTableTableManager($_db, $_db.shotTracingTable)
            .filter((f) => f.tournamentId.tournamentId($_item.tournamentId));

    final cache = $_typedResult
        .readTableOrNull(_InteractiveMapHolesTournamentIdTable($_db));
    return ProcessedTableManager(
        manager.$state.copyWith(prefetchedData: cache));
  }

Which results in

lib/database/database.g.dart:67382:55: Error: 'tournamentId' isn't a function or method and can't be invoked.
            .filter((f) => f.tournamentId.tournamentId($_item.tournamentId));
                                                      ^^^^^^^^^^^^
lib/database/database.g.dart:67787:38: Error: 'tournamentId' isn't a function or method and can't be invoked.
        .filter((f) => f.tournamentId($_item.tournamentId!));
                                     ^^^^^^^^^^^^
Target kernel_snapshot_program failed: Exception

Our table looks like

@DataClassName('ShotTracingEntity')
class ShotTracingTable extends Table {
  @ReferenceName('InteractiveMapHolesTournamentId')
  TextColumn get tournamentId =>
      text().references(InteractiveMapHolesTable, #tournamentId)();

  IntColumn get roundNumber => integer()();

  TextColumn get playerId => text()();

  @ReferenceName('InteractiveMapHolesHoleId')
  IntColumn get holeNumber =>
      integer().references(InteractiveMapHolesTable, #holeId)();

  IntColumn get strokeNumber => integer()();

  TextColumn get clubUsed => text()();

  TextColumn get description => text().nullable()();

  TextColumn get strokeType => text()();

  RealColumn get restingPointX => real().nullable()();

  RealColumn get restingPointY => real().nullable()();

  RealColumn get restingPointZ => real().nullable()();

  RealColumn get distanceToPin => real().nullable()();

  RealColumn get distanceTravelled => real().nullable()();

  RealColumn get tempC => real().nullable()();

  RealColumn get windSpeed => real().nullable()();

  IntColumn get windDirectionDegrees => integer().nullable()();

  TextColumn get windDirection => text()();

  RealColumn get humidity => real().nullable()();

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

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

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

  @override
  Set<Column> get primaryKey => {
        tournamentId,
        roundNumber,
        playerId,
        holeNumber,
        strokeNumber,
      };
}

We are using latest version, and latest version of the build runner.

@dickermoshe
Copy link
Collaborator

dickermoshe commented Sep 30, 2024

I really want to get this fixed ASAP.
Could you post the InteractiveMapHolesTable table too?

For now, If you don't plan on using the manager api, you can disable it's generation with

@simolus3 simolus3 added the area-manager Related to the manager, exposing an easier to use interface label Sep 30, 2024
@dickermoshe dickermoshe self-assigned this Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-manager Related to the manager, exposing an easier to use interface
Projects
None yet
Development

No branches or pull requests

3 participants