stdin_line 1.0.0 copy "stdin_line: ^1.0.0" to clipboard
stdin_line: ^1.0.0 copied to clipboard

It returns a stdin line split into words.

example/stdin_line_example.dart

import 'package:stdin_line/stdin_line.dart';

main() {
  print('type `add 2 2` or `subtract 5 3`');

  handleNewLine((words) {
    var command = words[0];
    if (command == 'add') {
      int result = int.parse(words[1]) + int.parse(words[2]);
      print(result);
    }
    else if (command == 'subtract') {
      int result = int.parse(words[1]) - int.parse(words[2]);
      print(result);
    }
  });
}
0
likes
30
pub points
0%
popularity

Publisher

unverified uploader

It returns a stdin line split into words.

Repository (GitHub)
View/report issues

License

BSD-2-Clause (LICENSE)

More

Packages that depend on stdin_line