Skip to content

Instantly share code, notes, and snippets.

View felangel's full-sized avatar
coding

Felix Angelov felangel

coding
View GitHub Profile
@felangel
felangel / login_state.dart
Last active January 7, 2019 00:47
[flutter_login_unit_tests] LoginState
import 'package:meta/meta.dart';
import 'package:equatable/equatable.dart';
class LoginState extends Equatable {
final bool isLoading;
final bool isLoginButtonEnabled;
final String error;
final String token;
LoginState({
@felangel
felangel / authentication_state.dart
Last active January 7, 2019 00:48
[flutter_login_unit_tests] AuthenticationState
import 'package:meta/meta.dart';
import 'package:equatable/equatable.dart';
abstract class AuthenticationState extends Equatable {
AuthenticationState([Iterable props]) : super(props);
}
class AuthenticationUninitialized extends AuthenticationState {
@override
String toString() => 'AuthenticationUninitialized';
@felangel
felangel / person.dart
Created January 7, 2019 03:03
[intro_equatable] Person
class Person {
final String name;
final int age;
const Person({this.name, this.age});
}
@felangel
felangel / main.dart
Created January 7, 2019 03:04
[intro_equatable] Person Instantiation
void main() {
final Person bob = Person(name: "Bob", age: 40);
}
@felangel
felangel / main.dart
Created January 7, 2019 03:08
[intro_equatable] Person Comparison I
void main() {
final Person bob = Person(name: "Bob", age: 40);
print(bob == Person(name: "Bob", age: 40)); // false
}
@felangel
felangel / person.dart
Created January 7, 2019 03:30
[intro_equatable] Person override == and hashcode
class Person {
final String name;
final int age;
const Person({this.name, this.age});
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is Person &&
@felangel
felangel / pubspec.yaml
Created January 21, 2019 20:08
[github_search] Common Pubspec.yaml
name: common_github_search
description: Shared Code between AngularDart and Flutter
version: 1.0.0+1
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
dependencies:
meta: ^1.1.7
bloc: ^0.8.0
@felangel
felangel / github_client.dart
Created January 21, 2019 20:12
[github_search] Github Client
import 'dart:async';
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:common_github_search/common_github_search.dart';
class GithubClient {
final String baseUrl;
final http.Client httpClient;
@felangel
felangel / search_result_model.dart
Created January 21, 2019 20:14
[github_search] Search Result Model
import 'package:common_github_search/common_github_search.dart';
class SearchResult {
final List<SearchResultItem> items;
const SearchResult({this.items});
static SearchResult fromJson(Map<String, dynamic> json) {
final items = (json['items'] as List<dynamic>)
.map((dynamic item) =>
@felangel
felangel / search_result_item.dart
Created January 21, 2019 20:16
[github_search] Search Result Item Model
import 'package:common_github_search/common_github_search.dart';
class SearchResultItem {
final String fullName;
final String htmlUrl;
final GithubUser owner;
const SearchResultItem({this.fullName, this.htmlUrl, this.owner});
static SearchResultItem fromJson(dynamic json) {