Line data Source code
1 : import 'package:memories_app/network/network_manager.dart'; 2 : import 'package:memories_app/util/api_endpoints.dart'; 3 : import 'package:memories_app/routes/register/model/register_request_model.dart'; 4 : import 'package:memories_app/routes/register/model/register_response_model.dart'; 5 : 6 : abstract class RegisterRepository { 7 : Future<RegisterResponseModel> register(RegisterRequestModel model); 8 : } 9 : 10 : class RegisterRepositoryImp extends RegisterRepository { 11 : final NetworkManager _networkManager; 12 : 13 1 : RegisterRepositoryImp({NetworkManager? networkManager}) : _networkManager = networkManager ?? NetworkManager(); 14 : 15 1 : @override 16 : Future<RegisterResponseModel> register(RegisterRequestModel model) async { 17 : final Result result = 18 2 : await _networkManager.post(ApiEndpoints.register, body: model); 19 2 : return RegisterResponseModel.fromJson(result.json); 20 : } 21 : }