morse 0.1.4

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new61

Morse Code #

version MIT License PRs Welcome

Watch on GitHub Star on GitHub

Usage #

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

dependencies:
  morse: ^0.1.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!

[0.1.4] - 4 March 2019

Enhancements #

  • Package does not rely on Flutter anymore (Available for web development)

[0.1.3] - 3 March 2019

Enhancements #

  • Increased support until Dart 3.0

[0.1.2] - 3 March 2019

Features #

  • Encode a string of text to morse code.
  • Added 18 special characters: !@$&()_+-=;:'",./?

Fixes / Enhancements #

  • Decoding morse code will return lowercased letters rather than uppercased letters.
  • Encode either uppercase and lowercase letters.
  • Restructured character map.

Docs #

  • Extended documentation to further explain the purpose of each function.

[0.1.1] - 28 February 2019

Fixes / Enhancements #

  • Upgraded dependencies for compatibility with Dart 2.

[0.1.0] - 16 June 2018

Fixes / Enhancements #

  • Initial version of the Morse class.

Docs #

  • Initial documentation.

example/example.dart

import 'package:morse/morse.dart';

main(){
  ////////////
  // METHOD //
  ////////////
  // Decode morse
  final decodeMorse = Morse().decode('.... . .-.. .-.. --- / .-- --- .-. .-.. -..');
  print(decodeMorse); // hello world

  // Encode morse
  final encodeMorse = Morse().encode('Hello World');
  print(encodeMorse); // .... . .-.. .-.. --- / .-- --- .-. .-.. -..

  /////////////////
  // CONSTRUCTOR //
  /////////////////
  // Decode morse
  final helloEncoded = new Morse('... --- ...');
  final decoded = helloEncoded.decode();
  print(decoded); // sos

  // Encode morse
  final helloWorld = new Morse('SOS');
  final encoded = helloWorld.encode();
  print(encoded); // ... --- ...
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  morse: ^0.1.4

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:morse/morse.dart';
  
Version Uploaded Documentation Archive
0.1.4 Mar 5, 2019 Go to the documentation of morse 0.1.4 Download morse 0.1.4 archive
0.1.3+5 Mar 5, 2019 Go to the documentation of morse 0.1.3+5 Download morse 0.1.3+5 archive
0.1.3+4 Mar 5, 2019 Go to the documentation of morse 0.1.3+4 Download morse 0.1.3+4 archive
0.1.3+3 Mar 5, 2019 Go to the documentation of morse 0.1.3+3 Download morse 0.1.3+3 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
22
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
61
Learn more about scoring.

We analyzed this package on Mar 6, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:morse/morse.dart.

Health suggestions

Format lib/src/morse_base.dart.

Run dartfmt to format lib/src/morse_base.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=0.0.0 <3.0.0
Dev dependencies
test ^1.5.3