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:flutter/cupertino.dart'; | |
import 'package:flutter/material.dart'; | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return new MaterialApp( | |
title: 'Squircle', | |
home: new Scaffold( |
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:flutter/material.dart'; | |
import 'package:flutter_bloc/flutter_bloc.dart'; | |
import 'package:functional_error_handling/features/post/presentation/widgets/custom_list_tile.dart'; | |
import 'package:functional_error_handling/features/post/presentation/widgets/error_dialog.dart'; | |
import 'bloc/posts_list.dart'; | |
class PostPage extends StatelessWidget { | |
const PostPage({Key? key}) : super(key: key); |
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/bloc.dart'; | |
import 'package:dartz/dartz.dart'; | |
import 'package:freezed_annotation/freezed_annotation.dart'; | |
import 'package:functional_error_handling/core/error_handling/error_handling.dart'; | |
import 'package:functional_error_handling/features/post/domain/entities/post_entity.dart'; | |
import 'package:functional_error_handling/features/post/domain/repositories/posts_repository.dart'; | |
part 'posts_list.freezed.dart'; |
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:dartz/dartz.dart'; | |
import 'package:http/http.dart' as http; | |
import 'package:functional_error_handling/core/error_handling/error_handling.dart'; | |
import 'package:functional_error_handling/features/post/data/datasources/json_placeholder_v1.dart'; | |
import 'package:functional_error_handling/features/post/domain/entities/post_entity.dart'; | |
import 'package:functional_error_handling/features/post/domain/repositories/posts_repository.dart'; | |
class PostsRepositoryImpl implements PostsRepository { | |
@override |
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:convert'; | |
import 'package:functional_error_handling/core/error_handling/error_handling.dart'; | |
import 'package:functional_error_handling/features/post/data/models/post_model.dart'; | |
import 'package:http/http.dart' as http; | |
class JsonPlaceholderV1 { | |
JsonPlaceholderV1({ | |
required this.httpClient, | |
}); |
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:equatable/equatable.dart'; | |
import 'failures.dart'; | |
class ErrorObject extends Equatable { | |
const ErrorObject({ | |
required this.title, | |
required this.message, | |
}); |
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:freezed_annotation/freezed_annotation.dart'; | |
part 'failures.freezed.dart'; | |
@freezed | |
class FailureEntity with _$FailureEntity { | |
const FailureEntity._(); // This constructor is needed to have custom methods in Freezed. | |
const factory FailureEntity.serverFailure() = ServerFailure; | |
const factory FailureEntity.dataParsingFailure() = DataParsingFailure; | |
const factory FailureEntity.noConnectionFailure() = NoConnectionFailure; |
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 ServerException implements Exception {} | |
class DataParsingException implements Exception {} | |
class NoConnectionException implements Exception {} |
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
/// Main | |
void main() { | |
final personOne = Person(name: "Mario", age: 23, height: 1.83); | |
print(personOne.describePerson()); | |
final employeeOne = Employee( | |
name: "Mario", | |
age: 23, | |
height: 1.83, |
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
# and write a program that returns a list that contains only the elements that are common between the | |
# lists (without duplicates). Make sure your program works on two lists of different sizes. | |
# exercise from http://www.practicepython.org/exercise/2014/03/05/05-list-overlap.html | |
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | |
b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] | |
c = [] | |
# Create list c | |
for num in a: |
NewerOlder