Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vycius/dart-gtfs-realtime-bindings
Provides Dart classes generated from the GTFS-realtime Protocol Buffer specification
https://github.com/vycius/dart-gtfs-realtime-bindings
Last synced: 2 months ago
JSON representation
Provides Dart classes generated from the GTFS-realtime Protocol Buffer specification
- Host: GitHub
- URL: https://github.com/vycius/dart-gtfs-realtime-bindings
- Owner: vycius
- License: mit
- Created: 2022-08-08T06:10:55.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-19T05:04:15.000Z (6 months ago)
- Last Synced: 2024-10-05T19:21:33.081Z (3 months ago)
- Language: Dart
- Homepage: https://pub.dev/packages/gtfs_realtime_bindings
- Size: 119 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Dart GTFS-Realtime Language Bindings
Provides Dart classes generated from the GTFS-realtime Protocol Buffer specification. These classes
will allow you to parse a binary Protocol Buffer GTFS-realtime data feed into Dart or Flutter.## Usage
The following code snippet demonstrates downloading a GTFS-realtime data feed from a particular URL,
parsing it as a FeedMessage (the root type of the GTFS-realtime schema).```dart
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}.');
}
```## Generation
The Protobuf spec is downloaded from .
The Dart code is generated using: `protoc --dart_out=lib/src gtfs-realtime.proto`
Note that this requires installing the binaries at .