morse_code 0.1.0

A library that converts morse code encoded strings to regular decoded strings.

Morse Code

version MIT License PRs Welcome

Watch on GitHub Star on GitHub

Usage

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

dependencies:
  morse_code: ^0.1.0

Now inside your Dart code you can import it.

import 'package:morse_code/morse_code.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 de 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);

Contributing

Feel free to open a PR with any suggetions!