This repository has been archived on 2022-04-20. You can view files and clone it, but cannot push or open issues or pull requests.
2018-09-22 20:56:16 +00:00
|
|
|
import 'package:vikunja_app/api/client.dart';
|
2018-09-17 16:16:50 +00:00
|
|
|
import 'package:meta/meta.dart';
|
|
|
|
|
|
|
|
class APIService {
|
|
|
|
final Client _client;
|
|
|
|
|
|
|
|
@protected
|
|
|
|
Client get client => _client;
|
|
|
|
|
|
|
|
APIService(this._client);
|
|
|
|
|
|
|
|
@protected
|
|
|
|
List<T> convertList<T>(dynamic value, Mapper<T> mapper) {
|
|
|
|
if (value == null) return [];
|
|
|
|
return (value as List<dynamic>).map((map) => mapper(map)).toList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef T Mapper<T>(Map<String, dynamic> json);
|