Skip to content

Instantly share code, notes, and snippets.

☕️
coding

Felix Angelov felangel

☕️
coding
Block or report user

Report or block felangel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@felangel
felangel / main.dart
Created Jun 26, 2019
Flutter Bloc Stepper
View main.dart
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:bloc/bloc.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:equatable/equatable.dart';
abstract class StepperEvent extends Equatable {
StepperEvent([List props = const []]) : super(props);
}
@felangel
felangel / main.dart
Last active Sep 10, 2019
Bloc with SearchDelegate
View main.dart
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:bloc/bloc.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@felangel
felangel / main.dart
Last active Aug 29, 2019
Recipe: Bloc Access (Routes)
View main.dart
import 'package:flutter/material.dart';
import 'package:bloc/bloc.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class SimpleBlocDelegate extends BlocDelegate {
@override
void onEvent(Bloc bloc, Object event) {
super.onEvent(bloc, event);
print(event);
}
@felangel
felangel / main.dart
Created Aug 4, 2019
[flutter_firestore_todos] main
View main.dart
import 'package:flutter/material.dart';
import 'package:bloc/bloc.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_firestore_todos/blocs/authentication_bloc/bloc.dart';
import 'package:todos_repository/todos_repository.dart';
import 'package:flutter_firestore_todos/blocs/blocs.dart';
import 'package:flutter_firestore_todos/screens/screens.dart';
import 'package:user_repository/user_repository.dart';
void main() {
@felangel
felangel / todos_bloc.dart
Created Aug 4, 2019
[flutter_firestore_todos] todos bloc snippet II
View todos_bloc.dart
Stream<TodosState> _mapTodosUpdateToState(TodosUpdated event) async* {
yield TodosLoaded(event.todos);
}
@felangel
felangel / todos_bloc.dart
Created Aug 4, 2019
[flutter_firestore_todos] todos bloc snippet
View todos_bloc.dart
Stream<TodosState> _mapLoadTodosToState() async* {
_todosSubscription?.cancel();
_todosSubscription = _todosRepository.todos().listen(
(todos) {
dispatch(
TodosUpdated(todos),
);
},
);
}
@felangel
felangel / todos_bloc.dart
Created Aug 4, 2019
[flutter_firestore_todos] todos bloc
View todos_bloc.dart
import 'dart:async';
import 'package:bloc/bloc.dart';
import 'package:meta/meta.dart';
import 'package:flutter_firestore_todos/blocs/todos/todos.dart';
import 'package:todos_repository/todos_repository.dart';
class TodosBloc extends Bloc<TodosEvent, TodosState> {
final TodosRepository _todosRepository;
StreamSubscription _todosSubscription;
@felangel
felangel / authentication_bloc.dart
Created Aug 4, 2019
[flutter_firestore_todos] authentication bloc
View authentication_bloc.dart
import 'dart:async';
import 'package:bloc/bloc.dart';
import 'package:meta/meta.dart';
import 'package:user_repository/user_repository.dart';
import 'package:flutter_firestore_todos/blocs/authentication_bloc/bloc.dart';
class AuthenticationBloc
extends Bloc<AuthenticationEvent, AuthenticationState> {
final UserRepository _userRepository;
@felangel
felangel / authentication_state.dart
Created Aug 4, 2019
[flutter_firestore_todos] authentication states
View authentication_state.dart
import 'package:equatable/equatable.dart';
import 'package:meta/meta.dart';
@immutable
abstract class AuthenticationState extends Equatable {
AuthenticationState([List props = const []]) : super(props);
}
class Uninitialized extends AuthenticationState {
@override
@felangel
felangel / authentication_event.dart
Created Aug 4, 2019
[flutter_firestore_todos] authentication events
View authentication_event.dart
import 'package:equatable/equatable.dart';
import 'package:meta/meta.dart';
@immutable
abstract class AuthenticationEvent extends Equatable {
AuthenticationEvent([List props = const []]) : super(props);
}
class AppStarted extends AuthenticationEvent {
@override
You can’t perform that action at this time.