gtfs_realtime_bindings 1.1.0 gtfs_realtime_bindings: ^1.1.0 copied to clipboard
Provides Dart classes generated from the GTFS-realtime Protocol Buffer specification.
example/gtfs_realtime_bindings_example.dart
import 'package:http/http.dart' as http;
import 'package:gtfs_realtime_bindings/gtfs_realtime_bindings.dart';
void main() async {
final url = Uri.parse('URL of your GTFS Realtime feed');
final response = await http.get(url);
if (response.statusCode == 200) {
final feedMessage = FeedMessage.fromBuffer(response.bodyBytes);
print('Number of entities: ${feedMessage.entity.length}.');
} else {
print('Request failed with status: ${response.statusCode}.');
}
}