1
0
mirror of https://github.com/go-vikunja/app synced 2024-10-05 05:38:30 +00:00
app-mirror-github/lib/api/service.dart
2018-09-22 20:56:16 +00:00

20 lines
433 B
Dart

import 'package:vikunja_app/api/client.dart';
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);