Last updated:
0 purchases
mallorca transit services
Mallorca Transit Services API #
Features #
An unofficial Dart package for the Balearic Islands' Public Transportation services.
It provides a simple way to access Mallorca's transportation services and get information about the bus stops, lines, schedules, etc.
This package is not affiliated with the government or the respective companies.
Getting started #
Install the package by adding it to your pubspec.yaml file:
dependencies:
mallorca_transit_services: ^1.0.1
copied to clipboard
Usage #
Get the list of bus stops:
await Stations.getStations();
copied to clipboard
Get the list of departures from a specific bus stop:
await Departures.getDepartures(stationId: id, numberOfDepartures: 10);
copied to clipboard
Get a list of lines that pass through a specific bus stop:
await Station.getLines(stationCode);
copied to clipboard
Get the list of all lines:
await RouteLine.getAllLines();
copied to clipboard
Get specific line information:
await RouteLine.getLine('A42');
copied to clipboard
Get the route of a specific line:
await RoutePath.getPath(route.code);
copied to clipboard
Listen to real-time updates of a specific bus:
LocationWebSocket.locationStream(busId).then((stream) {
stream.listen((message) {
final action = LocationWebSocket.locationParser(jsonDecode(message));
});
});
copied to clipboard
Get the RSS feed of the public warnings:
await TransitRss.getWarningFeed();
copied to clipboard
Get the RSS feed of the public news:
await TransitRss.getNewsFeed();
copied to clipboard
Scrape the website for the affected lines of a specific warning:
await TransitWarningScraper.scrapeAffectedLines(rssItem);
copied to clipboard
Scrape the website for the description of a specific warning:
await TransitWarningScraper.scrapeWarningDescription(rssItem);
copied to clipboard
Scrape the website for the timetable PDF of a specific line:
await RouteLine.getPdfTimetable('A42');
copied to clipboard
The full example can be found in the example.dart
Facing Issues? #
I'm trying my best to make this API as bug-free as possible, if you find any issues, please submit a bug report in the issues section of this repository.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.