32 lines
747 B
Dart
32 lines
747 B
Dart
import 'dart:convert';
|
|
|
|
import '../../connect_api.dart';
|
|
import '../rmv_models.dart';
|
|
|
|
class NearbyStops extends ConnectApi<List<StopLocation>> {
|
|
final double lat;
|
|
final double lon;
|
|
final int radiusMeters;
|
|
final int max;
|
|
|
|
NearbyStops({
|
|
required this.lat,
|
|
required this.lon,
|
|
this.radiusMeters = 1000,
|
|
this.max = 20,
|
|
}) : super('rmv/stops/nearby');
|
|
|
|
@override
|
|
Map<String, String>? get queryParameters => {
|
|
'lat': lat.toString(),
|
|
'lon': lon.toString(),
|
|
'radius': radiusMeters.toString(),
|
|
'max': max.toString(),
|
|
};
|
|
|
|
@override
|
|
List<StopLocation> assemble(String raw) => (jsonDecode(raw) as List)
|
|
.map((e) => StopLocation.fromJson(e as Map<String, dynamic>))
|
|
.toList(growable: false);
|
|
}
|