nmea 3.3.2 copy "nmea: ^3.3.2" to clipboard
nmea: ^3.3.2 copied to clipboard

An extensible NMEA0183 parser, which also supports validating the checksum. Useful for reading data from GPS devices and other sensors.

GitHub License Pub Version Pub Points Pub Likes Pub Popularity Pipeline

dart_nmea Logo nmea #

An extensible NMEA0183 parser.

Take a look at the example to see how to use it.

Usage #

// 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:

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
  }
});
5
likes
160
pub points
80%
popularity

Publisher

verified publisherricardoboss.de

An extensible NMEA0183 parser, which also supports validating the checksum. Useful for reading data from GPS devices and other sensors.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on nmea