Co-authored-by: eddgranados12 <eddgranados12@users.noreply.github.com>
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
This commit is contained in:
25
recolecta_app/lib/features/eta/eta_service.dart
Normal file
25
recolecta_app/lib/features/eta/eta_service.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
// 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)),
|
||||
);
|
||||
Reference in New Issue
Block a user