Git Product home page Git Product logo

Comments (10)

kuhnroyal avatar kuhnroyal commented on June 26, 2024

Had the same problem, but got it working somehow, don't remember if I disabled manager generation.
Try to use @GenerateNiceMocks and #managers as symbol name. Alternatively disable manager generation in build.yaml if you don't use them.

In general this should be changed in drift. The managers instance could be some interface type.

from drift.

frankvollebregt avatar frankvollebregt commented on June 26, 2024

Thank you! It now works with

@GenerateNiceMocks([
  MockSpec<MyDatabase>(unsupportedMembers: {#managers}),
])

I'll leave the issue open for now, since this only circumvents the issue, and I indeed suspect this isn't intended behavior

from drift.

zjcz avatar zjcz commented on June 26, 2024

As a workaround to this, the release notes for 2.18.0 mention you can turn this feature off in build.yaml - see https://drift.simonbinder.eu/docs/advanced-features/builder_options/ for more info.

Basically, create a file called build.yaml in the root of your Flutter project and add the following. When you next run build_runner, it won't generate the managers.

targets:
  $default:
    builders:
      drift_dev:
        options:
          generate_manager: false

from drift.

dickermoshe avatar dickermoshe commented on June 26, 2024

@frankvollebregt
This is my fault. I'll work on this.

I haven't had much experience with the Mockito library.
What sorta fix do you suppose would solve this issue?

from drift.

simolus3 avatar simolus3 commented on June 26, 2024

Judging from the error message it sounds like making the manager class public could be enough?

from drift.

dickermoshe avatar dickermoshe commented on June 26, 2024

@simolus3 Should we add this as a test in the future?

from drift.

simolus3 avatar simolus3 commented on June 26, 2024

Since we already have mockito as a dev dependency on drift I think it doesn't cost us anything to try to mock a generated database class as well, then the drift build fails if we break this again.

from drift.

dickermoshe avatar dickermoshe commented on June 26, 2024

@simolus3
I can't get melos bootstrap to work.
Seems that flutter doesn't work with analyzer 6.5.0
I got a fix for this once you find a fix for thar

Seems that updating drift_dev to use analyzer: '>=6.5.0 <7.0.0' instead of analyzer: '>=5.12.0 <7.0.0' broke drifts ability to work with flutter.
Could you modify the tests to bootstrap ALL the packages (right now --scope is limiting them).
It would be a nasty bug if dirft & flutter didn't work together
I'm opening another issue #3024

from drift.

dickermoshe avatar dickermoshe commented on June 26, 2024

Fixed via #3025

from drift.

frankvollebregt avatar frankvollebregt commented on June 26, 2024

Awesome! Thank you everyone for getting this sorted 👍

from drift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.