Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
40 views

I'm trying to mock the background_downloader package , specifically this line in my class I'm trying to mock: var status = await fileDownloader.permissions.status(permissionType); I keep getting error ...
Mike6679's user avatar
  • 6,146
1 vote
1 answer
103 views

I'm working with Flutter Bloc and noticed that when I dispatch the same event multiple times in quick succession, Bloc emits multiple Loading states before transitioning to Success. This behavior ...
TONI IVANOV's user avatar
2 votes
1 answer
196 views

I am using mocktail package. I am mocking WeatherRepository . So I don't quite understand what this error is . Please find the below code attached import 'package:weather_app/data/data_provider/...
Anish Hemachandran's user avatar
1 vote
0 answers
39 views

I am having issues with bloc_test, the expected does not match with the code. ** Expected: [ AuthenticationState:AuthenticationState(RequestStatus.initial, RequestStatus.loading, RequestStatus....
mbakabilal's user avatar
0 votes
1 answer
564 views

I am new at testing of flutter app, so I am trying to find out how to test it correctly, and now I am confused when I faced this error. When I try to change state in bloc_state testing then state ...
newbie2210's user avatar
0 votes
1 answer
302 views

When I want to test my completedIntroTutorial method, I'd like to also test the on Exception catch for that I call inside the unit test thenThrow, but it isn't throwing an exception. I have tried to ...
Tempelritter's user avatar
3 votes
1 answer
766 views

How can I test a bloc event using flutter bloc test that has a droppable (or restartable) event? Event example: on<SomeEvent>( _mapSomeEvent, transformer: droppable(), ); I tried calling ...
Ianmcuki's user avatar
0 votes
1 answer
522 views

I'm new to bloc and currently learning bloc testing. The below code is working fine in debug mode. However, I can't find anything to await the function to test the current position/error. Here is my ...
Akshay Rangari's user avatar
0 votes
1 answer
326 views

I am writing flutter test method using bloc_test and mockito library. I am getting below strange issue while mocking repository API call. It might be a simple fix but I am trying it since last couple ...
Rohit's user avatar
  • 965
3 votes
2 answers
3k views

I have a problem in Test section of flutter, I wrote a test for simple counter app which uses cubit, but while I run all test it gives me the error mentioned in header, any body knows why? it is ...
Jafar ashrafi's user avatar
3 votes
1 answer
2k views

I have tests like the below: blocTest( 'emits [ViewData.loading and ViewData.loaded] when GetRepositories is added', build: () { when( () => useCase....
R Rifa Fauzi Komara's user avatar
0 votes
0 answers
247 views

So I'm implementing blocTesting for my project and I'm getting an empty actual array from a specific feature. share_bloc_test.dart Below is the code for the blocFunction that is returning the empty ...
Nik's user avatar
  • 337
1 vote
1 answer
1k views

I'm trying to create a test case for getting list stores data and I currently fail to implement some working tests but I got some problems when trying to compare the data list. This is my test's code: ...
Nazarudin's user avatar
  • 1,075
0 votes
1 answer
728 views

Say I have a state class class MyState extends Equatable { final bool isSaving; final String errorMsg; const MyState({ this.isSaving = false, this.errorMsg = '', }); @override ...
chrallard's user avatar
  • 147
0 votes
1 answer
401 views

When following the bloc test documentation, I created the following blocTest; blocTest('should do something', build: () => SignInBloc(signIn: mockSignIn), act: (bloc) => bloc.add(const ...
c.lamont.dev's user avatar
1 vote
1 answer
648 views

I am trying to learn testing with bloc. Followed the procedure as stated in docs. I have lib/cubit/counter_cubit.dart and lib/cubit/counterState.dart files counter_cubit.dart is: import 'package:bloc/...
user avatar
2 votes
1 answer
4k views

This is my first effort at testing my Cubit class, so please bear with me as I am completely out of ideas after trying for many hours. I'm trying to test a simple cubit that looks like this: @...
AndroidDev's user avatar
  • 21.4k
5 votes
1 answer
3k views

I tried the solutions in here https://github.com/felangel/mocktail/issues/42 but still get error. This is my code: class MockUserRepository extends Mock implements UserRepository {} class ...
noyruto88's user avatar
  • 907
0 votes
2 answers
1k views

I'm trying to make a unit test using the bloc_test library. Here are my codes. Login Cubit class LoginCubit extends Cubit<LoginState> with HydratedMixin { final UserRepository _userRepository; ...
Zouglou's user avatar
  • 129
7 votes
1 answer
3k views

I have this bloc_test in my Flutter code blocTest<ProjectsBloc, ProjectsState>( 'emits [ProjectsState.loading(), ProjectsState.succes([])] with empty projects', build: () => ...
Rob van Putten's user avatar
2 votes
1 answer
6k views

I have a bloc that works to get cartItem from orderItem by id and i want to test the bloc, I've read some bloc testing from flutter_bloc but I still don't know how to implement it on my bloc. I want ...
Raka Prasetyo's user avatar
1 vote
1 answer
770 views

I'm confused by the results of the test below the first doesn't pass, but somehow the second does not what am I missing? thank you void main() { group('UserAuthenticationCubit', () { const user ...
aoatmon's user avatar
  • 597
1 vote
2 answers
2k views

How can I test a Timer inside a Bloc, using blocTest? I’m using the bloc library, with freezed to build the state and event objects (might not matter here, but who knows). So let’s say I have ...
michpohl's user avatar
  • 1,125
0 votes
1 answer
811 views

So i have a simple Cubit class that looks like this: It is ment to change the isClosed value based on the scrollValue of the list, so if user scrolls up, some widget is going to close. const ...
Marcel Iwanicki's user avatar
0 votes
1 answer
2k views

I have been trying to set up unit testing for my cubit but bloc test seems to be having issues. Just trying to check the initial state of the values works just fine with regular test but as soon as I ...
DA_cloak's user avatar
2 votes
1 answer
2k views

I'm testing a bloc method that fetch a list of restaurants fro the api. here is my code : import 'package:bloc_test/bloc_test.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:...
karmous's user avatar
  • 197
1 vote
0 answers
1k views

Currently trying to implement Unit testing for my cubit and am feeling there is a severe lack in documentation for BLoC test online or useful examples. Can anyone explain what I'm doing wrong with ...
DA_cloak's user avatar
1 vote
1 answer
1k views

i have a bloc that listens to a stream for authentication events (listening for firebase user events). my block is; class AuthenticationBloc extends Bloc<AuthenticationEvent, ...
socrates hlapolosa's user avatar
2 votes
1 answer
688 views

I am using flutter_bloc, bloc_test, and bloc_testing to implement testing. But even after I initialize Bloc in Setup the errors say Null check operator used on a null value. import 'package:bloc_test/...
Raj Dhakad's user avatar
1 vote
2 answers
783 views

I have a flutter bloc_test which is failing due to recent upgrades in Flutter involving null safety. I have the following code blocTest('get the usecase name', build: () { when(() =&...
MikeSmith's user avatar
  • 389
9 votes
2 answers
5k views

I'm working on an app using a WeatherAPI. I currently fail to implement some working tests. I tried to follow ResoCoders Guide (https://resocoder.com/2019/11/29/bloc-test-tutorial-easier-way-to-test-...
CoffeeToCodette's user avatar
9 votes
1 answer
12k views

I'm trying to implement a Widget Test in order to test a login form. This test depends on a bloc which I'm mocking by using MockBloc. However, it throws the following error: ══╡ EXCEPTION CAUGHT BY ...
Yunet Luis Ruíz's user avatar