Sequence Library

A library for Dart developers.

Created from templates made available by Stagehand under a BSD-style license.

Usage

A simple usage example:

import 'package:sequence/sequence.dart';

main() {
  FibonacciSequence s = FibonacciSequence();
  for (int i = 0; i < 100; i++) print(s.next());
}

class FibonacciSequence extends Object with Sequence<int> {
  int curr = 0, prev = 1;

  FibonacciSequence()
      : curr = 0,
        prev = 1;

  @override
  int next() {
    super.next();
    int next = curr + prev;
    prev = curr;
    curr = next;
    return next;
  }

  @override
  int max() => curr;

  @override
  int min() => 0;
}

Features and bugs

Please file feature requests and bugs at the issue tracker.

Libraries

sequence