lexicographical_order 1.0.1 copy "lexicographical_order: ^1.0.1" to clipboard
lexicographical_order: ^1.0.1 copied to clipboard

outdated

A string generator that helps to implement a lexicographical order.

Lexicographical Order #

A string generator that helps to implement a lexicographical order.

Installing #

dependencies:
  lexicographical_order: 
import 'package:lexicographical_order/lexicographical_order.dart';

Usage #

  • Get the string between two strings in a lexicographical order.

    final mid = between(prev: 'B', next: 'D');
    final list = [mid, 'D', 'B'];
    assert(listEqauls(list..sort(), ['B', mid, 'D']);
    
    • practice

      class Todo {
        final int id;
        String title;
        bool completed
        String _orderKey;
            
        void reorderBetween(Todo? prev, Todo? next) {
      	_orderKey = between(
            prev: prev?._orderKey, 
            next: next?._orderKey,
          );
        }
            
        Todo(/* omitted */);
      }
      
  • Generates strings that satisfy the minimum average string length and lexicographic order.

    const stringCount = 100;
    List<String> orderKeys = generateOrderKeys(stringCount).toList(); 
    

Caution #

  • Don't use 'A' as first order key

    In the lexicographical order, no character can precede 'A'.

7
likes
0
pub points
45%
popularity

Publisher

verified publishersylfree.com

A string generator that helps to implement a lexicographical order.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

characters

More

Packages that depend on lexicographical_order