Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ricardoboss/dart_nmea
An extensible NMEA0183 parser written 100% in dart.
https://github.com/ricardoboss/dart_nmea
cross-platform dart flutter library nmea nmea-parser nmea0183
Last synced: about 2 months ago
JSON representation
An extensible NMEA0183 parser written 100% in dart.
- Host: GitHub
- URL: https://github.com/ricardoboss/dart_nmea
- Owner: ricardoboss
- License: mit
- Created: 2022-06-06T22:44:38.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-10T22:10:45.000Z (3 months ago)
- Last Synced: 2024-10-16T09:21:45.730Z (2 months ago)
- Topics: cross-platform, dart, flutter, library, nmea, nmea-parser, nmea0183
- Language: Dart
- Homepage: https://pub.dev/packages/nmea
- Size: 127 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
![GitHub License](https://img.shields.io/github/license/ricardoboss/dart_nmea)
![Pub Version](https://img.shields.io/pub/v/nmea)
![Pub Points](https://img.shields.io/pub/points/nmea)
![Pub Likes](https://img.shields.io/pub/likes/nmea)
![Pub Popularity](https://img.shields.io/pub/popularity/nmea)
[![Pipeline](https://github.com/ricardoboss/dart_nmea/actions/workflows/dart.yml/badge.svg)](https://github.com/ricardoboss/dart_nmea/actions/workflows/dart.yml)# ![dart_nmea Logo](https://raw.githubusercontent.com/ricardoboss/dart_nmea/main/images/logo_32.png) nmea
An extensible NMEA0183 parser.
Take a look at the [example](example/example.dart) to see how to use it.
## Usage
```dart
// 1. declare your sentences (use TalkerSentence and ProprietarySentence)
class AbcSentence extends TalkerSentence {
AbcSentence({required super.raw});
String get data => fields[1];
@override
bool get valid => super.valid && fields.length == 2;
}// 2. register your sentences
final decoder = NmeaDecoder()
..registerTalkerSentence('ABC', (line) => AbcSentence(raw: line));// 3. decode a line
final sentence = decoder.decode(r'$--ABC,123456789*5D');// 4. consume your sentences
print(sentence.valid); // true
print(sentence.checksum); // 5D
print(sentence.source); // --
if (sentence is AbcSentence) {
print(sentence.data); // 123456789
}
```You can also use it as a StreamTransformer for a stream of Strings:
```dart
final stream = Stream.fromIterable([r'$--ABC,123456789*5D', r'$--DEF,987654321*5D']);
final transformed = stream.transform(decoder);
transformed.listen((sentence) {
print(sentence.valid); // true
print(sentence.checksum); // 5D
print(sentence.source); // --
if (sentence is AbcSentence) {
print(sentence.data); // 123456789
}
});
```