mallorca_transit_services 1.1.0 copy "mallorca_transit_services: ^1.1.0" to clipboard
mallorca_transit_services: ^1.1.0 copied to clipboard

An unofficial, public API to access Mallorca's transportation 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.

1
likes
160
points
156
downloads

Publisher

verified publisheryarosfpv.com

Weekly Downloads

2024.10.06 - 2025.04.20

An unofficial, public API to access Mallorca's transportation services

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

dart_rss, html, http, latlong2, web_socket_channel, xml

More

Packages that depend on mallorca_transit_services