galnet 2.0.0
galnet: ^2.0.0 copied to clipboard
A Dart client for the Elite Dangerous Galnet API. Fetch articles with pagination, locale support, and full type safety.
A lightweight Dart client for accessing Galnet articles from the video game Elite: Dangerous, using the official RSS feed.
Built on top of the http package, this library provides a simple and efficient way to retrieve and process news
articles published on Galnet, leveraging the platform's native HTTP implementation.
Installation #
Add the dependency to your pubspec.yaml:
dependencies:
galnet: ^2.0.0
Or install it via the command line:
dart pub add galnet
Usage #
import 'package:galnet/galnet.dart';
Future<void> main() async {
/// Create a new GalnetClient instance with a user agent and default locale.
final GalnetClient client = GalnetClient(
userAgent: 'GalnetExampleApp/1.0.0',
locale: GalnetLocales.enGB,
);
try {
/// Example 1: Fetch a single page of the latest articles.
print('Fetching latest Galnet articles...');
final ResponsePage response = await client.fetch();
print('Found ${response.articles.length} articles:');
for (final Article article in response.articles) {
print('- ${article.title} (${article.galnetDate.toIso8601String()})');
}
} on GalnetApiException catch (e) {
/// Handle API errors (4xx, 5xx status codes).
print('API Error [${e.statusCode}]: ${e.message}');
} on GalnetTimeoutException catch (e) {
/// Handle request timeout errors.
print('Request timed out: ${e.message}');
} on GalnetDataException catch (e) {
/// Handle invalid or missing data in the response.
print('Data error: ${e.message}');
} finally {
/// Always close the client to release network resources.
client.close();
}
}
License #
This project is licensed under the terms described in the LICENSE file.
⚠️ Disclaimer #
Elite: Dangerous © 2012–2025 Frontier Developments plc. All rights reserved.
This project is not affiliated with, endorsed by, or in any way officially connected to Frontier Developments plc.
This project use endpoint from https://cms.zaonce.net which are not officially documented and can change and became unavailable without notice Issues related to this will be closed without warning