11 lines
No EOL
399 B
Dart
11 lines
No EOL
399 B
Dart
import 'dart:convert';
|
|
|
|
import 'package:http/http.dart' as http;
|
|
import 'package:info_tren/api/common.dart';
|
|
import 'package:info_tren/models.dart';
|
|
|
|
Future<List<TrainsResult>> get trains async {
|
|
final result = await http.get(Uri.https(authority, 'v2/trains'));
|
|
final data = jsonDecode(result.body) as List<dynamic>;
|
|
return data.map((e) => TrainsResult.fromJson(e)).toList(growable: false,);
|
|
} |