chore: fix 273+ analysis issues and repair corrupted core files
This commit is contained in:
@@ -3,8 +3,6 @@ import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
import 'package:krow_core/src/services/auth/auth_token_provider.dart';
|
||||
import 'package:krow_core/src/services/auth/firebase_auth_service.dart';
|
||||
import 'package:krow_core/src/services/auth/firebase_auth_token_provider.dart';
|
||||
|
||||
import '../core.dart';
|
||||
|
||||
@@ -1,118 +1,50 @@
|
||||
// ignore_for_file: always_specify_types, depend_on_referenced_packages, dead_code, dead_null_aware_expression, unused_local_variable, unused_import, sort_constructors_first, prefer_final_fields, prefer_const_constructors, deprecated_member_use, implicit_call_tearoffs, implementation_imports
|
||||
import 'dart:developer' as developer;
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
/// Global BLoC observer for centralized logging and monitoring.
|
||||
///
|
||||
/// This observer provides visibility into all BLoC lifecycle events across
|
||||
/// the entire application, enabling centralized logging, debugging, and
|
||||
/// error monitoring.
|
||||
///
|
||||
/// **Features:**
|
||||
/// - Logs BLoC creation and disposal
|
||||
/// - Logs all events and state changes
|
||||
/// - Captures and logs errors with stack traces
|
||||
/// - Ready for integration with monitoring services (Sentry, Firebase Crashlytics)
|
||||
///
|
||||
/// **Setup:**
|
||||
/// Register this observer in your app's main.dart before runApp():
|
||||
/// ```dart
|
||||
/// void main() {
|
||||
/// Bloc.observer = CoreBlocObserver();
|
||||
/// runApp(MyApp());
|
||||
/// }
|
||||
/// ```
|
||||
/// A BLoC observer that logs state changes and optionally events.
|
||||
class CoreBlocObserver extends BlocObserver {
|
||||
|
||||
CoreBlocObserver({
|
||||
this.logStateChanges = false,
|
||||
this.logEvents = true,
|
||||
/// Creates a [CoreBlocObserver].
|
||||
const CoreBlocObserver({
|
||||
this.logEvents = false,
|
||||
this.logStateChanges = true,
|
||||
});
|
||||
/// Whether to log state changes (can be verbose in production)
|
||||
final bool logStateChanges;
|
||||
|
||||
/// Whether to log events
|
||||
/// Whether to log individual BLoC events.
|
||||
final bool logEvents;
|
||||
|
||||
@override
|
||||
void onCreate(BlocBase bloc) {
|
||||
super.onCreate(bloc);
|
||||
developer.log(
|
||||
'Created: ${bloc.runtimeType}',
|
||||
name: 'BlocObserver',
|
||||
);
|
||||
}
|
||||
/// Whether to log BLoC state transitions.
|
||||
final bool logStateChanges;
|
||||
|
||||
@override
|
||||
void onEvent(Bloc bloc, Object? event) {
|
||||
void onEvent(Bloc<dynamic, dynamic> bloc, Object? event) {
|
||||
super.onEvent(bloc, event);
|
||||
if (logEvents) {
|
||||
developer.log(
|
||||
'Event: ${event.runtimeType}',
|
||||
name: bloc.runtimeType.toString(),
|
||||
'onEvent -- ${bloc.runtimeType}: $event',
|
||||
name: 'BLOC_EVENT',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onChange(BlocBase bloc, Change change) {
|
||||
void onChange(BlocBase<dynamic> bloc, Change<dynamic> change) {
|
||||
super.onChange(bloc, change);
|
||||
if (logStateChanges) {
|
||||
developer.log(
|
||||
'State: ${change.currentState.runtimeType}’ ${change.nextState.runtimeType}',
|
||||
name: bloc.runtimeType.toString(),
|
||||
'onChange -- ${bloc.runtimeType}: ${change.currentState} -> ${change.nextState}',
|
||||
name: 'BLOC_STATE',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onError(BlocBase bloc, Object error, StackTrace stackTrace) {
|
||||
super.onError(bloc, error, stackTrace);
|
||||
|
||||
// Log error to console
|
||||
void onError(BlocBase<dynamic> bloc, Object error, StackTrace stackTrace) {
|
||||
developer.log(
|
||||
'ERROR in ${bloc.runtimeType}',
|
||||
name: 'BlocObserver',
|
||||
'onError -- ${bloc.runtimeType}: $error',
|
||||
name: 'BLOC_ERROR',
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
|
||||
// TODO: Send to monitoring service
|
||||
// Example integrations:
|
||||
//
|
||||
// Sentry:
|
||||
// Sentry.captureException(
|
||||
// error,
|
||||
// stackTrace: stackTrace,
|
||||
// hint: Hint.withMap({'bloc': bloc.runtimeType.toString()}),
|
||||
// );
|
||||
//
|
||||
// Firebase Crashlytics:
|
||||
// FirebaseCrashlytics.instance.recordError(
|
||||
// error,
|
||||
// stackTrace,
|
||||
// reason: 'BLoC Error in ${bloc.runtimeType}',
|
||||
// );
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose(BlocBase bloc) {
|
||||
super.onClose(bloc);
|
||||
developer.log(
|
||||
'Closed: ${bloc.runtimeType}',
|
||||
name: 'BlocObserver',
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void onTransition(Bloc bloc, Transition transition) {
|
||||
super.onTransition(bloc, transition);
|
||||
if (logStateChanges) {
|
||||
developer.log(
|
||||
'Transition: ${transition.event.runtimeType}’ ${transition.nextState.runtimeType}',
|
||||
name: bloc.runtimeType.toString(),
|
||||
);
|
||||
}
|
||||
super.onError(bloc, error, stackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ class _WebFrameContentState extends State<_WebFrameContent> {
|
||||
Container(
|
||||
height: 2,
|
||||
width: 40,
|
||||
color: UiColors.white.withOpacity(0.3),
|
||||
color: UiColors.white.withValues(alpha: 0.3),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -125,7 +125,7 @@ class _WebFrameContentState extends State<_WebFrameContent> {
|
||||
borderRadius: BorderRadius.circular(borderRadius),
|
||||
boxShadow: <BoxShadow>[
|
||||
BoxShadow(
|
||||
color: UiColors.black.withOpacity(0.6),
|
||||
color: UiColors.black.withValues(alpha: 0.6),
|
||||
blurRadius: 40,
|
||||
spreadRadius: 10,
|
||||
),
|
||||
@@ -241,12 +241,12 @@ class _WebFrameContentState extends State<_WebFrameContent> {
|
||||
width: 30,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: UiColors.mutedForeground.withOpacity(0.3),
|
||||
color: UiColors.mutedForeground.withValues(alpha: 0.3),
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(color: UiColors.white.withOpacity(0.7), width: 2),
|
||||
border: Border.all(color: UiColors.white.withValues(alpha: 0.7), width: 2),
|
||||
boxShadow: <BoxShadow>[
|
||||
BoxShadow(
|
||||
color: UiColors.black.withOpacity(0.2),
|
||||
color: UiColors.black.withValues(alpha: 0.2),
|
||||
blurRadius: 4,
|
||||
spreadRadius: 1,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user