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
955 B
28 lines
955 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/intro_params.dart';
|
|
import 'package:hadi_hoda_flutter/core/response/base_response.dart';
|
|
import 'package:hadi_hoda_flutter/features/intro/data/model/intro_model.dart';
|
|
import 'package:hadi_hoda_flutter/features/intro/domain/entity/intro_entity.dart';
|
|
|
|
abstract class IIntroDatasource {
|
|
Future<IntroEntity> getData({required IntroParams params});
|
|
}
|
|
|
|
class IntroDatasourceImpl implements IIntroDatasource {
|
|
final IHttpRequest httpRequest;
|
|
|
|
const IntroDatasourceImpl(this.httpRequest);
|
|
|
|
@override
|
|
Future<IntroEntity> getData({required IntroParams params}) async {
|
|
final response = await httpRequest.get(
|
|
path: MyApi.baseUrl,
|
|
);
|
|
|
|
return BaseResponse.getData<IntroEntity>(
|
|
response?['data'],
|
|
(json) => IntroModel.fromJson(json),
|
|
);
|
|
}
|
|
}
|