emote_utils 2.0.2

  • Readme
  • Changelog
  • Installing
  • 67

A library for working with emote strings in text-based games, such as MOO.

Usage #

A simple usage example:

import 'package:emote_utils/emote_utils.dart';

/// Create a pretend player class.
class Player {
  /// Create it with a name.

  /// The name of the player.
  String name;

void main() {
  // Create some players:
  final Player bill = Player('Bill');
  final Player ben = Player('Ben');
  final Player jane = Player('Jane');
  // Create a socials factory, bound to the Player type.
  // The SocialsFactory.sensible constructor gives you some reasonable defaults (at least in english), ensuring that word endings like "y", "es", and "s" work as expected.
  final SocialsFactory<Player> f = SocialsFactory<Player>.sensible();
  // Add a suffix, to give us player names.
  f.addSuffix(<String>['n'], (Player p) => SuffixResult('you', p.name));
  // Generate some strings.
  final SocialContext<Player> ctx = f.getStrings('%1N punch%1es %2n.', <Player>[jane, bill]);
  // We could go through and send them all out by hand, but we can do better:
    <Player>[bill, ben, jane],
    (Player p, String s) => print('${p.name} sees: $s')

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Changelog #

1.0.0 #

  • Initial version, created by Stagehand

1.0.1 #

  • Fix the description

1.0.2 #

Added support for emotes.

1.0.4 #

Using a HashMap for social strings.

2.0.0 #

Updated version because I've done something strange.

2.0.1 #

Make code more concise.

2.0.2 #

Added "e" as an alias for the "es" suffix.

Use this package as a library

1. Depend on it

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

  emote_utils: ^2.0.2

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:emote_utils/emote_utils.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jul 8, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14

Health suggestions

Format lib/src/constants.dart.

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

Format lib/src/emote_utils_base.dart.

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

Format lib/src/errors.dart.

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

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and emote_utils.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.8.4 <3.0.0
Dev dependencies
pedantic any
test any