Skip to content

Commit

Permalink
Merge pull request #340 from dwyl/refactor_#339
Browse files Browse the repository at this point in the history
[PR] Code refactor
  • Loading branch information
nelsonic authored Aug 15, 2023
2 parents 4b541cd + 6bd265f commit c72ffe3
Show file tree
Hide file tree
Showing 25 changed files with 763 additions and 627 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Run tests
run: flutter test --coverage

- uses: codecov/codecov-action@v2
- uses: codecov/codecov-action@v3
with:
files: coverage/lcov.info
verbose: true # optional (default = false)
Expand All @@ -49,7 +49,7 @@ jobs:
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install Flutter
uses: subosito/flutter-action@v2
Expand Down
2 changes: 1 addition & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file configures the analyzer, which statically analyzes Dart code to
# This file configures the analyzer, which statically analyses Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
Expand Down
3 changes: 3 additions & 0 deletions lib/blocs/blocs.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export 'package:flutter_bloc/flutter_bloc.dart';

export 'todo/todo_bloc.dart';
2 changes: 1 addition & 1 deletion lib/bloc/todo_bloc.dart → lib/blocs/todo/todo_bloc.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:equatable/equatable.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

import '../models/item.dart';
import '../../models/item.dart';

part 'todo_event.dart';
part 'todo_state.dart';
Expand Down
File renamed without changes.
File renamed without changes.
29 changes: 29 additions & 0 deletions lib/logging/log_bloc_observer.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lumberdash/lumberdash.dart';

class GlobalLogBlocObserver extends BlocObserver {
@override
void onEvent(Bloc bloc, Object? event) {
super.onEvent(bloc, event);
logMessage('${bloc.runtimeType} event dispatch: $event.');
}

@override
void onChange(BlocBase bloc, Change change) {
super.onChange(bloc, change);
}

@override
void onTransition(Bloc bloc, Transition transition) {
super.onTransition(bloc, transition);
logMessage('${bloc.runtimeType} transition: Event ${transition.event} was dispatched. ${transition.currentState} → ${transition.nextState}');
}

@override
void onError(BlocBase bloc, Object error, StackTrace stackTrace) {
super.onError(bloc, error, stackTrace);

logWarning('${bloc.runtimeType} error: $error.');
logError('Stacktrace: \n$stackTrace');
}
}
4 changes: 4 additions & 0 deletions lib/logging/logging.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export 'package:colorize_lumberdash/colorize_lumberdash.dart';
export 'package:lumberdash/lumberdash.dart';

export 'log_bloc_observer.dart';
Loading

0 comments on commit c72ffe3

Please sign in to comment.