import 'package:http/http.dart' as http; import 'package:info_tren/api/common.dart'; import 'package:info_tren/models.dart'; Future getTrain(String trainNumber, {DateTime? date}) async { date ??= DateTime.now(); final response = await http.get(Uri.https(authority, 'v2/train/$trainNumber', { 'date': date.toUtc().toIso8601String(), }),); return trainDataFromJson(response.body); }