Skip to main content

algeria_transit_services 2.2.0 copy "algeria_transit_services: ^2.2.0" to clipboard
algeria_transit_services: ^2.2.0 copied to clipboard

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

algeria_transit_services #

Dart client for the Massar API: community bus tracking in Algeria (pilot: Cheria, Tébessa). Bus positions are shared voluntarily by drivers with the Massar Driver app.

Not affiliated with any government entity, public agency or official transport service.

Features #

  • Stops and lines: Station.getAllStations(), Station.getLines(code), RouteLine.getAllLines(), RouteLine.getLine(code), Subline.getSublines(line), RoutePath.getPath(subline) (KML route geometry).
  • Live departures: Departures.getDepartures(stationCode:, numberOfDepartures:), only buses tracked right now.
  • Realtime: LocationWebSocket.locationChannel(lineId) and locationParser(), which yield BusPosition, RouteStationInfo (ETAs to the upcoming stops), BusStale and ConnectionClose.
  • Trip planning: TripPlanner.plan(...), leaving now, with walks, rides and transfers (TripPlan, TripOption, WalkLeg, RideLeg).
  • Place search: Places.search(query), OpenStreetMap places near the Massar city, through the backend.
  • When no bus is live: RouteLine.service / LineService.fetch(lineId): fare, first and last bus, frequency (set by admins or learned from past buses).
  • Alerts: Alerts.fetch(lineId:, stopId:) (ServiceAlert).
  • Offline: MassarApi.useHttpClient(OfflineHttpClient(store: ...)) serves saved lines, stops and paths without network; MassarApi.downloadForOffline().
  • Community: Feedback.send(kind, ...) to report a problem; BusShare.send(...) to share the position of the bus you ride, anonymously; LocationWebSocket.follow(channel, busId).

Codes are system codes: cities use their postal code (12002), lines 12002-L01, stops 12002-S0001. RouteLine.number is the short number shown to passengers (1).

Usage #

import 'package:algeria_transit_services/algeria_transit_services.dart';

final stations = await Station.getAllStations();
final departures = await Departures.getDepartures(stationCode: '12002-S0006', numberOfDepartures: 5);
final plan = await TripPlanner.plan(fromLat: 35.2712, fromLng: 7.7530, toStopCode: '12002-S0011');

See example/example.dart for a longer tour.

Development #

dart pub get
dart analyze
dart test   # uses real API responses saved in test/fixtures
0
likes
150
points
430
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

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

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

http, latlong2, web_socket_channel, xml

More

Packages that depend on algeria_transit_services