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
| name: my_movies | |
| description: A new Flutter application. | |
| dependencies: | |
| flutter: | |
| sdk: flutter | |
| cupertino_icons: ^0.1.2 | |
| rxdart: ^0.18.0 | |
| http: ^0.12.0+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
| class State<T>{ | |
| State._(); | |
| factory State.success(T value) = SuccessState<T>; | |
| factory State.error(T msg) = ErrorState<T>; | |
| } | |
| class ErrorState<T> extends State<T> { | |
| ErrorState(this.msg) : super._(); | |
| final T msg; | |
| } |
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 'dart:async'; | |
| import 'dart:convert'; | |
| import 'package:http/http.dart' show Client, Response; | |
| import '../models/item_model.dart'; | |
| import '../models/trailer_model.dart'; | |
| import 'package:inject/inject.dart'; | |
| import '../models/state.dart'; | |
| class MovieApiProvider { | |
| final Client client; |
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 'dart:async'; | |
| import 'movie_api_provider.dart'; | |
| import 'package:inject/inject.dart'; | |
| import '../models/state.dart'; | |
| class Repository { | |
| final MovieApiProvider _moviesApiProvider; | |
| @provide |
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 '../resources/repository.dart'; | |
| import 'package:rxdart/rxdart.dart'; | |
| import '../models/item_model.dart'; | |
| import '../models/state.dart'; | |
| import 'package:inject/inject.dart'; | |
| import 'bloc_base.dart'; | |
| class MoviesBloc extends BlocBase { | |
| final Repository _repository; | |
| PublishSubject<ItemModel> _moviesFetcher; |
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:rxdart/rxdart.dart'; | |
| import '../models/trailer_model.dart'; | |
| import '../resources/repository.dart'; | |
| import 'bloc_base.dart'; | |
| import 'package:inject/inject.dart'; | |
| import '../models/state.dart'; | |
| class MovieDetailBloc extends BlocBase { | |
| final Repository _repository; | |
| BehaviorSubject<TrailerModel> _trailers; |
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 'dart:async'; | |
| import 'package:flutter/material.dart'; | |
| import '../blocs/movie_detail_bloc.dart'; | |
| import '../models/trailer_model.dart'; | |
| class MovieDetail extends StatefulWidget { | |
| final MovieDetailBloc bloc; | |
| final String posterUrl; | |
| final String description; |
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:mockito/mockito.dart'; | |
| import 'package:http/http.dart' as http ; | |
| class MockClient extends Mock implements http.Client {} |
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:inject/inject.dart'; | |
| import 'provider_injector.inject.dart' as g; | |
| import 'provider_module.dart'; | |
| import 'provider_test.dart'; | |
| @Injector(const [ProviderModule]) | |
| abstract class ProviderTestInjector{ | |
| @provide | |
| ProviderTest get app; |
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:inject/inject.dart'; | |
| import 'package:my_movies/src/resources/movie_api_provider.dart'; | |
| import 'package:http/http.dart' as http; | |
| import 'mock_client.dart'; | |
| @module | |
| class ProviderModule{ | |
| @provide |