Skip to content

Instantly share code, notes, and snippets.

@becek2n
Created May 8, 2020 14:24
Show Gist options
  • Save becek2n/239771e52d58b55adab594fc36185d24 to your computer and use it in GitHub Desktop.
Save becek2n/239771e52d58b55adab594fc36185d24 to your computer and use it in GitHub Desktop.
import 'dart:convert';
import 'package:listview_bind_api/APIService.dart';
import 'package:listview_bind_api/AttendanceModel.dart';
import 'package:listview_bind_api/ResultModel.dart';
class AttendanceRepositories{
final String urlHost = 'http://172.20.10.10/';
static APIService<List<AttendanceModel>> get getData {
return APIService(
url: 'http://172.20.10.10/RELEASE-API/Api/attendance/getdata',
parse: (response) {
final parsed = json.decode(response.body);
final dataJson = ResultModel.fromJSON(parsed);
return dataJson.responsedata.map((i) => AttendanceModel.fromJSON(i)).toList();
}
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment