import 'dart:io'; import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'dio_client.dart'; class UserProfileService { late final Dio _dio; UserProfileService(BuildContext context) { _dio = DioClient.getInstance(context); } /// Get profile Future> getProfile() async { try { final res = await _dio.get('/user/profile'); return Map.from(res.data); } catch (e) { return {"success": false, "message": e.toString()}; } } /// Update profile IMAGE only Future> updateProfileImage(File image) async { try { final form = FormData.fromMap({ "profile_image": await MultipartFile.fromFile(image.path), }); final res = await _dio.post('/user/profile-image', data: form); return Map.from(res.data); } catch (e) { return {"success": false, "message": e.toString()}; } } /// Send profile update request (admin approval needed) Future> sendUpdateRequest(Map data) async { try { final res = await _dio.post('/user/profile-update-request', data: data); return Map.from(res.data); } catch (e) { return {"success": false, "message": e.toString()}; } } }