Category "flutter-test"

error when Add a stub for a method using Mockito's 'when' API

Have this abstract class to get data from remote data source abstract class NumberTriviaRemoteDataSource { /// Calls the http://numberapi.com/{number} endpoin

PDF file download from url and store on internal storage then try to open it from any PDF reader its shows file format is not supported in flutter

I am trying to open my downloaded PDF file within my app then it shows fine, but when I open it from any other app like PDF reader its shows file format is not

Error when hitting the back button in camera

getting this issue when we click on back camera while using the app .. any one could you please find and send the solution to this issue in flutter Exception ha

How to solve "Invalid image data" error in Flutter

I'm using SQLite for storing data locally. insert an image as a string and get them to show here is the error that occurs _Exception (Exception: Invalid image d

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