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/level_params.dart';
|
|
import 'package:hadi_hoda_flutter/core/response/base_response.dart';
|
|
import 'package:hadi_hoda_flutter/features/level/data/model/level_model.dart';
|
|
import 'package:hadi_hoda_flutter/features/level/domain/entity/level_entity.dart';
|
|
|
|
abstract class ILevelDatasource {
|
|
Future<LevelEntity> getData({required LevelParams params});
|
|
}
|
|
|
|
class LevelDatasourceImpl implements ILevelDatasource {
|
|
final IHttpRequest httpRequest;
|
|
|
|
const LevelDatasourceImpl(this.httpRequest);
|
|
|
|
@override
|
|
Future<LevelEntity> getData({required LevelParams params}) async {
|
|
final response = await httpRequest.get(
|
|
path: MyApi.baseUrl,
|
|
);
|
|
|
|
return BaseResponse.getData<LevelEntity>(
|
|
response?['data'],
|
|
(json) => LevelModel.fromJson(json),
|
|
);
|
|
}
|
|
}
|