Inspired by dannyfritz/commit-message-emoji
See also gitmoji.
| Commit type | Emoji |
|---|---|
| Initial commit | 🎉 :tada: |
| Version tag | 🔖 :bookmark: |
| New feature | ✨ :sparkles: |
| Bugfix | 🐛 :bug: |
Inspired by dannyfritz/commit-message-emoji
See also gitmoji.
| Commit type | Emoji |
|---|---|
| Initial commit | 🎉 :tada: |
| Version tag | 🔖 :bookmark: |
| New feature | ✨ :sparkles: |
| Bugfix | 🐛 :bug: |
| class MyHomePage extends StatefulWidget { | |
| @override | |
| _MyHomePageState createState() => _MyHomePageState(); | |
| } | |
| class _MyHomePageState extends State<MyHomePage> { | |
| @override | |
| void initState() { | |
| context.bloc<MovieBloc>().add(LoadMovies()); | |
| super.initState(); |
| import 'package:dio/dio.dart'; | |
| import 'package:network_handling/model/movie_response.dart'; | |
| import 'package:network_handling/services/api_result.dart'; | |
| import 'package:network_handling/services/dio_client.dart'; | |
| import 'package:network_handling/services/network_exceptions.dart'; | |
| class APIRepository { | |
| DioClient dioClient; | |
| final String _apiKey = "78b9f63937763a206bff26c070b94158"; | |
| String _baseUrl = "http://api.themoviedb.org/3/"; |
| class MovieResponse { | |
| int page; | |
| int totalResults; | |
| int totalPages; | |
| List<Movie> results; | |
| MovieResponse({this.page, this.totalResults, this.totalPages, this.results}); | |
| MovieResponse.fromJson(Map<String, dynamic> json) { | |
| page = json['page']; |
| import 'package:flutter/foundation.dart'; | |
| import 'package:freezed_annotation/freezed_annotation.dart'; | |
| import 'network_exceptions.dart'; | |
| part 'api_result.freezed.dart'; | |
| @freezed | |
| abstract class ApiResult<T> with _$ApiResult<T> { |
| import 'dart:io'; | |
| import 'package:dio/dio.dart'; | |
| import 'package:freezed_annotation/freezed_annotation.dart'; | |
| part 'network_exceptions.freezed.dart'; | |
| @freezed | |
| abstract class NetworkExceptions with _$NetworkExceptions { | |
| const factory NetworkExceptions.requestCancelled() = RequestCancelled; |
| import 'dart:io'; | |
| import 'package:dio/dio.dart'; | |
| import 'package:flutter/foundation.dart'; | |
| const _defaultConnectTimeout = Duration.millisecondsPerMinute; | |
| const _defaultReceiveTimeout = Duration.millisecondsPerMinute; | |
| class DioClient { | |
| final String baseUrl; |
| StreamBuilder<Result<List<Prediction>>>( | |
| stream: placePredictionSearchBloc.streamController.stream, | |
| initialData: Result.idle(), | |
| builder: (BuildContext context, | |
| AsyncSnapshot<Result<List<Prediction>>> snapshot) { | |
| return snapshot.data.when(idle: () { | |
| return Container(); | |
| }, loading: () { | |
| return CircularProgressIndicator(); | |
| }, success: (List<AutocompletePrediction> value) { |
| class PlacePredictionSearchBloc { | |
| StreamController<Result<List<Prediction>>> streamController = | |
| StreamController<Result<List<Prediction>>>(); | |
| AppRepository appRepository = AppRepository(); | |
| Future<void> getCurrentAddress(String search) async { | |
| streamController.sink.add(Result.loading()); | |
| try { |
| // GENERATED CODE - DO NOT MODIFY BY HAND | |
| // ignore_for_file: deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named | |
| part of 'result.dart'; | |
| // ************************************************************************** | |
| // FreezedGenerator | |
| // ************************************************************************** | |
| T _$identity<T>(T value) => value; |