Co-authored-by: MENDOZA BALLARDO GAEL RICARDO <gael-meb123@users.noreply.github.com> Co-authored-by: Azareth-Tr <Azareth-Tr@users.noreply.github.com> modificacion de vistas panel admin, login, animaciones y implementacion de mascota
26 lines
772 B
Dart
26 lines
772 B
Dart
// lib/features/eta/eta_service.dart
|
|
// Llama a GET /eta?address_id=X via dio.
|
|
// La respuesta NUNCA contiene coordenadas (validado en backend + RLS).
|
|
|
|
import 'package:dio/dio.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:recolecta_app/core/network/api_client.dart';
|
|
import 'package:recolecta_app/features/eta/eta_model.dart';
|
|
|
|
class EtaService {
|
|
final Dio _dio;
|
|
EtaService(this._dio);
|
|
|
|
Future<EtaResponse> fetchEta(String addressId) async {
|
|
final response = await _dio.get<Map<String, dynamic>>(
|
|
'/eta',
|
|
queryParameters: {'address_id': addressId},
|
|
);
|
|
return EtaResponse.fromJson(response.data!);
|
|
}
|
|
}
|
|
|
|
final etaServiceProvider = Provider<EtaService>(
|
|
(ref) => EtaService(ref.read(apiClientProvider)),
|
|
);
|