morse 0.1.4+1

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

Morse Code #

version MIT License PRs Welcome

Watch on GitHub Star on GitHub

Usage #

First, add this library as a dependency in the pubspec.yaml file:

dependencies:
  morse: ^0.1.4+1

Import the Morse class into your Dart file as follows:

import 'package:morse/morse.dart';

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

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

There are two ways to decode morse code. 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 pull request with any suggestions!

[0.1.4] - 4 March 2019

Fixes / Enhancements #

  • Package is now available for all Dart projects (Flutter, Web, and etc.)

[0.1.3] - 3 March 2019

Enhancements #

  • Increased support until Dart 3.0
  • Package doesn't rely on Flutter anymore (Still not available for web development)
  • Thanks to u/qualverse for the quick notice!

[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.
  • Forked @HofmannZ's repository to continue maintaining his package and add new features.

[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+1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub 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+1 Apr 21, 2019 Go to the documentation of morse 0.1.4+1 Download morse 0.1.4+1 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]
32
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]
66
Learn more about scoring.

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

  • Dart: 2.3.1
  • pana: 0.12.17

Platforms

Detected platforms: Flutter, web, other

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

Dependencies

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