slot_machine 5.0.0

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

Slot machine

A simple, self-contained class that allows user to put a simple slot machine to the DOM.

See the demo.

example/example.dart

import 'dart:html';

import 'package:slot_machine/slot_machine.dart';

void main() {
  final container = querySelector("#slot_container");
  final rerollContainer = querySelector("#reroll_container");
  final resultEl = querySelector("#slot_result");
  final RangeInputElement probabilityEl = querySelector("#probability");
  final probabilitySpan = querySelector("#probability_span");
  final randomButton = querySelector("#random_button");

  // Allow setting up probability.
  num probability = 0.75;
  probabilityEl.onChange.listen((_) {
    probability = probabilityEl.valueAsNumber / 100;
    probabilitySpan.text = "${probabilityEl.value}%";
  });

  // Handle click of buttons.
  void handle(_) {
    container.children.clear();
    rerollContainer.children.clear();
    resultEl.children.clear();

    final slotMachine = new SlotMachine(probability,
        rerollable: true, rerollEffectDescription: "use coin");
    container.append(slotMachine.canvasEl);
    rerollContainer.append(slotMachine.rerollEl);
    resultEl.append(slotMachine.resultEl);
    slotMachine.play().then(print);
  }

  randomButton.onClick.listen(handle);
}

1. Depend on it

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


dependencies:
  slot_machine: "^5.0.0"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:slot_machine/slot_machine.dart';
        
Version Uploaded Documentation Archive
5.0.0 Sep 24, 2017 Go to the documentation of slot_machine 5.0.0 Download slot_machine 5.0.0 archive
3.1.0 Jan 16, 2017 Go to the documentation of slot_machine 3.1.0 Download slot_machine 3.1.0 archive
3.0.1 Jan 10, 2017 Go to the documentation of slot_machine 3.0.1 Download slot_machine 3.0.1 archive
2.1.2 Jan 8, 2017 Go to the documentation of slot_machine 2.1.2 Download slot_machine 2.1.2 archive
2.1.1 Jan 8, 2017 Go to the documentation of slot_machine 2.1.1 Download slot_machine 2.1.1 archive
2.1.0 Jan 6, 2017 Go to the documentation of slot_machine 2.1.0 Download slot_machine 2.1.0 archive
2.0.1 Jan 5, 2017 Go to the documentation of slot_machine 2.0.1 Download slot_machine 2.0.1 archive
2.0.0 Jan 4, 2017 Go to the documentation of slot_machine 2.0.0 Download slot_machine 2.0.0 archive
1.0.1 Oct 1, 2014 Go to the documentation of slot_machine 1.0.1 Download slot_machine 1.0.1 archive
1.0.0 Sep 26, 2014 Go to the documentation of slot_machine 1.0.0 Download slot_machine 1.0.0 archive

Analysis

We analyzed this package on Apr 23, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
41 / 100
Health:
Code health derived from static analysis. [more]
100 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80 / 100
Overall score:
Weighted score of the above. [more]
66
Learn more about scoring.

Platforms

Detected platforms: web

Primary library: package:slot_machine/slot_machine.dart with components: html.

Suggestions

  • Maintain CHANGELOG.md.

    Changelog entries help clients to follow the progress in your code.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 hint.

    Strong-mode analysis of lib/src/precomputed_setups.dart gave the following hint:

    line: 43 col: 20
    'INFINITY' is deprecated and shouldn't be used.

  • Use analysis_options.yaml.

    Rename old .analysis_options file to analysis_options.yaml.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.22.0 <2.0.0
browser ^0.10.0+2 0.10.0+3
Dev dependencies
test ^0.12.19+1