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
copied to clipboard

Now inside your dart project you can import it.

import 'package:morse_code_translator/morse_code_translator.dart';
copied to clipboard

Decoding Morse code #

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

String  decodingValue = ".... .. / - .... . .-. . / .... --- .-- / .- .-. . / -.-- --- ..- ..--..";
copied to clipboard

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

MorseCode  meroMorseCode = MorseCode();
var  de = meroMorseCode.deCode(decodingValue);
copied to clipboard

and the corresponding output can be seen

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

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?";
copied to clipboard

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

MorseCode  meroMorseCode = MorseCode();
var  en = meroMorseCode.enCode(encodingValue);
copied to clipboard

and the corresponding output can be seen

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

print("$en\n");
copied to clipboard

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 !

10
likes
130
points
171
downloads

Publisher

unverified uploader

Weekly Downloads

2024.08.09 - 2025.02.21

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

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on morse_code_translator