You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							28 lines
						
					
					
						
							970 B
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							28 lines
						
					
					
						
							970 B
						
					
					
				| import 'package:hadi_hoda_flutter/core/constants/my_api.dart'; | |
| import 'package:hadi_hoda_flutter/core/network/http_request.dart'; | |
| import 'package:hadi_hoda_flutter/core/params/sample_params.dart'; | |
| import 'package:hadi_hoda_flutter/core/response/base_response.dart'; | |
| import 'package:hadi_hoda_flutter/features/sample/data/model/sample_model.dart'; | |
| import 'package:hadi_hoda_flutter/features/sample/domain/entity/sample_entity.dart'; | |
| 
 | |
| abstract class ISampleDatasource { | |
|   Future<SampleEntity> getData({required SampleParams params}); | |
| } | |
| 
 | |
| class SampleDatasourceImpl implements ISampleDatasource { | |
|   final IHttpRequest httpRequest; | |
| 
 | |
|   const SampleDatasourceImpl(this.httpRequest); | |
| 
 | |
|   @override | |
|   Future<SampleEntity> getData({required SampleParams params}) async { | |
|     final response = await httpRequest.get( | |
|         path: MyApi.baseUrl, | |
|     ); | |
| 
 | |
|     return BaseResponse.getData<SampleEntity>( | |
|       response?['data'], | |
|       (json) => SampleModel.fromJson(json), | |
|     ); | |
|   } | |
| }
 |