morse_code_translator 0.0.1 copy "morse_code_translator: ^0.0.1" to clipboard
morse_code_translator: ^0.0.1 copied to clipboard

A library that converts Morse code to decoded string and normal string to encoded Morse code.

Morse Code Translator #

Usage #

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

dependencies:
  morse_code_translator: ^0.0.1

Now inside your dart project you can import it.

import 'package:morse_code_translator/morse_code_translator.dart';

Decoding Morse code #

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

String  decodingValue = ".... .. / - .... . .-. . / .... --- .-- / .- .-. . / -.-- --- ..- ..--..";

Now, we have to decode the Morse code to corresponding string .First we initialize the object.

MorseCode  meroMorseCode = MorseCode();
var  de = meroMorseCode.deCode(decodingValue);

and the corresponding output can be seen

print("The morse code '$decodingValue' is decoded to corresponding String:");
print(de);

print statement is for test purpose we can use it with widgets by passing value to text widget or we can use it with TextField and pass value in onChanged property.

Encoding #

String  encodingValue = "Hi there how are you?";

Now, we have to encode the String to corresponding Morse code .First we initialize the object.

MorseCode  meroMorseCode = MorseCode();
var  en = meroMorseCode.enCode(encodingValue);

and the corresponding output can be seen

print("The String '$encodingValue' is encoded to corresponding morse code:");

print("$en\n");

print statement is for test purpose we can use it with widgets by passing value to text widget or we can use it with TextField and pass value in onChanged property.

I had implemented the library here, you can give a look and figure out how to use this library with widgets: https://github.com/Sushil787/MorseCodeTranslator #

Contributing #

Feel for opening a PR with any suggestions !

9
likes
110
pub points
57%
popularity

Publisher

unverified uploader

A library that converts Morse code to decoded string and normal string to encoded Morse code.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on morse_code_translator