step 3 : hapus ai_barcode_scanner, ai barcode, update permission_handler, flutter_map,latlong2

This commit is contained in:
sindhu
2025-04-11 13:39:17 +07:00
parent aa05bb5d51
commit 25fdce45f9
141 changed files with 19594 additions and 165 deletions

View File

@@ -0,0 +1,70 @@
import 'dart:convert';
import 'package:equatable/equatable.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import '../../repository/base_repository.dart';
import '../../provider/dio_provider.dart';
import '../../repository/kurir_tolak_repository.dart';
//provider
final kurirTolakProvider =
StateNotifierProvider<KurirTolakNotifier, KurirTolakState>(
(ref) => KurirTolakNotifier(ref: ref));
// notifier
class KurirTolakNotifier extends StateNotifier<KurirTolakState> {
final Ref ref;
KurirTolakNotifier({
required this.ref,
}) : super(KurirTolakStateInit());
void tolakKurir(
{required String id,
required String tipeId,
required String deliveryId,
required String note}) async {
try {
state = KurirTolakStateLoading();
final dio = ref.read(dioProvider);
final resp = await KurirTolakRepository(dio: dio).getKurirTolak(
id: id, tipeId: tipeId, deliveryId: deliveryId, note: note);
state = KurirTolakStateDone(model: resp);
} catch (e) {
if (e is BaseRepositoryException) {
state = KurirTolakStateError(message: e.message.toString());
} else {
state = KurirTolakStateError(message: e.toString());
}
}
}
}
abstract class KurirTolakState extends Equatable {
final DateTime date;
const KurirTolakState(this.date);
@override
List<Object?> get props => [date];
}
class KurirTolakStateInit extends KurirTolakState {
KurirTolakStateInit() : super(DateTime.now());
}
class KurirTolakStateLoading extends KurirTolakState {
KurirTolakStateLoading() : super(DateTime.now());
}
class KurirTolakStateError extends KurirTolakState {
final String message;
KurirTolakStateError({
required this.message,
}) : super(DateTime.now());
}
class KurirTolakStateDone extends KurirTolakState {
final bool model;
KurirTolakStateDone({
required this.model,
}) : super(DateTime.now());
}