34 lines
872 B
Dart
34 lines
872 B
Dart
import 'dart:convert';
|
|
|
|
import 'package:http/http.dart';
|
|
|
|
import '../../../Model/Response/Staffs/Getstaffsresponse.dart';
|
|
|
|
class GetStaffsProvider{
|
|
|
|
Future<GetStaffsResponse?> getStaffs(String urldata,) async {
|
|
GetStaffsResponse? getStaffsResponse;
|
|
try {
|
|
|
|
final url = Uri.parse('$urldata');
|
|
|
|
final response = await get(url, headers: {
|
|
'Content-Type': 'application/json',
|
|
'Accept': 'application/json',
|
|
// 'Authorization': '$token',
|
|
});
|
|
print('getStaffsResponse!!!!!!!!${response.body}');
|
|
print('getStaffsproviderurldata!!!!!!!!${urldata.toString()}');
|
|
Map<String, dynamic> parsedJson = json.decode(response.body.toString());
|
|
|
|
getStaffsResponse = GetStaffsResponse.fromJson(parsedJson);
|
|
|
|
} catch (e) {
|
|
print(e.toString());
|
|
print("error");
|
|
}
|
|
return getStaffsResponse;
|
|
}
|
|
|
|
|
|
} |