This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"configurations": [ | |
{ | |
"name": "Flutter", | |
"request": "launch", | |
"type": "dart", | |
"toolArgs": [ | |
"--dart-define", | |
"ANNIVERSARY=I_HAVE_NO_IDEA" | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"configurations":[ | |
{ | |
"name":"Flutter", | |
"request":"launch", | |
"type":"dart", | |
"toolArgs":[ | |
"--dart-define", | |
"MY_VAR=MY_VALUE", | |
"--dart-define", | |
"MY_OTHER_VAR=MY_OTHER_VALUE" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"configurations": [ | |
{ | |
"name": "Flutter", | |
"request": "launch", | |
"type": "dart", | |
"toolArgs": [ | |
"--dart-define", | |
"MY_VAR=MY_VALUE", | |
"--dart-define", | |
"MY_OTHER_VAR=MY_OTHER_VALUE" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final movieProvider = FutureProvider.autoDispose<TMDBMovieBasic>((ref) async { | |
// get the repository | |
final moviesRepo = ref.watch(fetchMoviesRepositoryProvider); | |
// an object from package:dio that allows cancelling http requests | |
final cancelToken = CancelToken(); | |
// if the request is successful, keep the response | |
// get the [KeepAliveLink] | |
final link = ref.keepAlive(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:bloc_test/bloc_test.dart'; | |
import 'package:flutter_test/flutter_test.dart'; | |
import 'package:mockito/annotations.dart'; | |
import 'package:mockito/mockito.dart'; | |
import 'package:music_player_bloc/features/play_music/bloc/music_player_bloc.dart'; | |
import 'package:music_player_bloc/features/play_music/core/track_timer.dart'; | |
import 'package:music_player_bloc/features/play_music/repository/playlist_repository.dart'; | |
import 'constants.dart'; | |
@GenerateNiceMocks([ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blocTest( | |
'Skip to the previous track', | |
build: () => musicPlayerBloc, | |
setUp: () { | |
when(trackTimer.passedTime(trackDuration: anyNamed('trackDuration'))) | |
.thenAnswer((_) => Duration.zero); | |
}, | |
seed: () => state.copyWith( | |
status: PlayerStatus.playing, | |
currentTime: const Duration(seconds: 10), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blocTest( | |
'Skip to the next track while there is no remaining track', | |
build: () => musicPlayerBloc, | |
setUp: () { | |
when(trackTimer.passedTime(trackDuration: anyNamed('trackDuration'))) | |
.thenAnswer((_) => const Duration(seconds: 0)); | |
}, | |
seed: () => state.copyWith( | |
status: PlayerStatus.playing, | |
currentTrackIndex: blues90s.tracks.length - 1, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blocTest( | |
'Skip to the next track while there is no remaining track', | |
build: () => musicPlayerBloc, | |
setUp: () { | |
when(trackTimer.passedTime(trackDuration: anyNamed('trackDuration'))) | |
.thenAnswer((_) => const Duration(seconds: 0)); | |
}, | |
seed: () => state.copyWith( | |
status: PlayerStatus.playing, | |
currentTrackIndex: blues90s.tracks.length - 1, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blocTest( | |
'Skip next track', | |
build: () => musicPlayerBloc, | |
setUp: () { | |
when(trackTimer.passedTime(trackDuration: anyNamed('trackDuration'))) | |
.thenAnswer((_) => const Duration(seconds: 0)); | |
}, | |
seed: () => state.copyWith( | |
status: PlayerStatus.playing, | |
), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blocTest<MusicPlayerBloc, MusicPlayerState>( | |
'Play the first track', | |
build: () => musicPlayerBloc, | |
setUp: () { | |
when(trackTimer.passedTime(trackDuration: anyNamed('trackDuration'))) | |
.thenAnswer((_) => const Duration(seconds: 0)); | |
}, | |
act: (bloc) => bloc.add(const MusicPlayerEvent.play()), | |
skip: 1, | |
expect: () => <MusicPlayerState>[ |