morse 0.1.3+4 copy "morse: ^0.1.3+4" to clipboard
morse: ^0.1.3+4 copied to clipboard

discontinued
outdated

A simple library that converts morse code.

Morse Code #

version MIT License PRs Welcome

Watch on GitHub Star on GitHub

Usage #

Fist depend on the libary by adding this to your package's pubspec.yaml:

dependencies:
  morse: ^0.1.3+4

Now inside your Dart code you can import it.

import 'package:morse/morse.dart';

For this example we're going to use the following morse code string:

final String encodedMessage = '.... . .-.. .-.. --- / .-- --- .-. .-.. -..';

There are two ways to decode a morse code string. Either provide the encoded string as an argument to the constructor, and call the decode method.

final Morse morse = new Morse(encodedMessage);
String decodedMessage = morse.decode();

// Or combine the two, for more compact code:
String decodedMessage =  new Morse(encodedMessage).decode();

Or provide the encoded string as an argument to the decode method.

final Morse morse = new Morse();
String decodedMessage = morse.decode(encodedMessage);

// Or again combine the two, for more compact code:
String decodedMessage =  new Morse().decode(encodedMessage);

You can also use the encode method to convert text to morse code.

final String message = 'Hello World';
final Morse morse = new Morse(message);
String encodedMessage = morse.encode();

// Or combine the two, for more compact code:
String encodedMessage =  new Morse(message).encode();

Contributing #

Feel free to open a PR with any suggetions!

4
likes
0
pub points
33%
popularity

Publisher

unverified uploader

A simple library that converts morse code.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on morse