autotrie 2.0.0 copy "autotrie: ^2.0.0" to clipboard
autotrie: ^2.0.0 copied to clipboard

A auto-completion engine for Dart/Flutter, based around an optimized Trie implementation.

example/autotrie_example.dart

import 'dart:io';

import 'package:autotrie/autotrie.dart';

void main() {
  var engine = AutoComplete(engine: SortEngine.configMulti(Duration(seconds: 1), 15, 0.5, 0.5)); //You can also initialize with a starting databank.

  var interval = Duration(milliseconds: 1);

  engine.enter('more'); // Enter more thrice.
  engine.enter('more');
  engine.enter('more');

  engine.enter('moody'); // Enter moody twice.
  engine.enter('moody');

  engine.enter('morose'); // Enter scattered words (with mo).
  engine.enter('morty');
  sleep(interval);
  engine.enter('moment');
  sleep(interval);
  engine.enter('momentum');

  engine.enter('sorose'); // Enter scattered words (without mo).
  engine.enter('sorty');

  engine.delete('morose'); // Delete morose.

  // Check if morose is deleted.
  print('Morose deletion check: ${!engine.contains('morose')}');

  // Check if engine is empty.
  print('Engine emptiness check: ${engine.isEmpty}');

  // Suggestions starting with 'mo'.
  // They've been ranked by frequency and recency. Since they're all so similar
  // in recency, frequency takes priority.
  print("'mo' suggestions: ${engine.suggest('mo')}");
  // Result: [more, moody, momentum, moment, morty]

  // Get all entries.
  // They've not been sorted.
  print('All entries: ${engine.allEntries}');
  // Result: [more, moody, sorty, sorose, momentum, moment, morty]
}

// Check the API Reference for the latest information and adv.
// methods from this class.
41
likes
150
pub points
71%
popularity

Publisher

verified publisherkishoredev.live

A auto-completion engine for Dart/Flutter, based around an optimized Trie implementation.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MPL-2.0 (license)

Dependencies

hive

More

Packages that depend on autotrie