Category "flutter-test"

How to test navigation via Navigator in Flutter

Let's say, I have a test for a screen in Flutter using WidgetTester. There is a button, which executes a navigation via Navigator. I would like to test behavior

Mock a Widget in Flutter tests

I am trying to create tests for my Flutter application. Simple example: class MyWidget extends StatelessWidget { @override build(BuildContext context) {

Is it possible to run a web test with extensions?

I am running the following test @TestOn('chrome') import 'package:flutter_test/flutter_test.dart'; import 'package:flutter/foundation.dart'; import 'package:m

Flutter: Coverage:ignore not working with async methods

I can't ignore any async Functions from code coverage. I try to exclude File.exists() from my Code coverage. Attempts: Tried with // coverage:ignore-line ->

How to test code that uses DateTime.now in Flutter?

I have this class: import 'package:flutter/material.dart'; class AgeText extends StatelessWidget { final String dateOfBirth; const AgeText({Key key, @req

I want to create a cart view

I want to create a cartview by allowing an item to be selected once I click on the Icon Button then the item is pushed to the cartview and it can show if the it

Flutter widget test of elevated button color

Widget test for elevated button background color test fails, My Build method of Button @override Widget build(BuildContext context) { return Container

Flutter error, Null check operator used on a null value

Whenever I tried to do register and tap on the register button then I am having this type of problem with the null check operator used on null values. I get thi

How to Widget test Share package using widget test

I have an issue with trying to test Share package. My code looks like this: IconButton( key: Key('share-button'), icon: Icon(Platform.isAndroid ? Icons.shar

Widget test fails with No MediaQuery widget found

My question is about flutter widget test, what is proper way to test existing widgets wrapped new Scaffold(...)? I have found MediaQuery.of but it accepts Build

The argument type 'Future<UserCredential>' can't be assigned to the parameter type 'dynamic Function()'

I am learning about TDD and practicing my test writing. I want to write a test for my login through Firebase. here is the test file: import 'package:firebase/fi

Running all flutter unit tests from Android Studio

I used to be able to run all my Flutter unit tests from the Android Studio GUI by right clicking on the tests directory and clicking on "Run 'tests in my_app'".

Flutter testing error: NotInitializedError which involves environment variables (.env)

To start, I did review this but to no avail. How to access Flutter environment variables from tests? import 'package:flutter/widgets.dart'; import 'package:flut