Git Product home page Git Product logo

Comments (7)

klisiewicz avatar klisiewicz commented on June 11, 2024 7

I was able to run the example by explicitly adding types. That means I changed the source code from:

onPressed: () => Navigator.of(context).push(MySettingsPage.route()),

to:

onPressed: () => Navigator.of(context).push<void>(MySettingsPage.route()),
static Route route() {
    return MaterialPageRoute(
      builder: (_) => const MySettingsPage(),
      settings: const RouteSettings(name: '/settings'),
    );
}

to:

static Route<void> route() {
    return MaterialPageRoute<void>(
      builder: (_) => const MySettingsPage(),
      settings: const RouteSettings(name: '/settings'),
    );
}

As well as the tests:

when(() => navigator.push(any())).thenAnswer((_) async {});

to:

when(() => navigator.push<void>(any())).thenAnswer((_) async {});

and finally the assertion:

verify(() => navigator.push(any(that: isRoute<void>(whereName: equals('/settings'))))).called(1);

to:

verify(() => navigator.push<void>(any<Route<void>>(that: isRoute<void>(whereName: equals('/settings'))))).called(1);

I hope this helps.

from mockingjay.

jeroen-meijer avatar jeroen-meijer commented on June 11, 2024 2

Hey there,

Thank you all for flagging this! I'll look at this later today. If the solution is simple, expect a fix today as well 👍🏻

from mockingjay.

robsonsilv4 avatar robsonsilv4 commented on June 11, 2024 1

@jeroen-meijer any news about the investigation and solution?

from mockingjay.

cornwe19 avatar cornwe19 commented on June 11, 2024

I am also experiencing a similar issue.

from mockingjay.

Hwan-seok avatar Hwan-seok commented on June 11, 2024

sorry for the annoying alarm but so am I..

The following _TypeError was thrown running a test:
type 'Null' is not a subtype of type 'Future<Object?>'

When the exception was thrown, this was the stack:
#0      MockNavigator.pushNamed (package:flutter/src/widgets/navigator.dart:4094:14)
#1      _MockNavigatorState.pushNamed (package:mockingjay/src/mock_navigator.dart:88:23)

from mockingjay.

nickesk avatar nickesk commented on June 11, 2024

I'm getting the same error as well, though I did have to change line 22 to get this to run:

static Route<void> route() {

from mockingjay.

donghyeon avatar donghyeon commented on June 11, 2024

The test will pass when changing to the previous versions.
mocktail v0.2.0
mockingjay v0.2.0

There is a change related to this issue in the mocktail v0.3.0 update.

from mockingjay.

Related Issues (17)

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.