Fix local dev config and ALOTTTT OFF FLUTTER, im tired boss..

This commit is contained in:
Wowieee4
2026-05-26 21:09:13 +07:00
parent b8ad8df993
commit a629357e8c
72 changed files with 2566 additions and 530 deletions
@@ -0,0 +1,38 @@
import 'package:flutter_bloc/flutter_bloc.dart';
import '../domain/repositories/sos_repository.dart';
enum SosPhase { idle, sending, sent, error }
class SosState {
final SosPhase phase;
final String? message;
const SosState({this.phase = SosPhase.idle, this.message});
}
class SosCubit extends Cubit<SosState> {
final SosRepository _repository;
SosCubit(this._repository) : super(const SosState());
Future<void> trigger({
String triggerType = 'MANUAL',
double? lat,
double? lng,
}) async {
emit(const SosState(phase: SosPhase.sending));
final result = await _repository.triggerSos(
triggerType: triggerType,
lat: lat,
lng: lng,
);
result.fold(
(failure) => emit(SosState(phase: SosPhase.error, message: failure.message)),
(_) => emit(const SosState(
phase: SosPhase.sent,
message: 'SOS terkirim. Guardian sudah diberi tahu.',
)),
);
}
}