ready method

Future<void> ready()

A Future value that will end until LyricsParser is ready.

If create LyricsParser from a file instance, LyricsParser will read file. This I/O opreation need to be wait before formal parsing operation.

var parser = LyricsParser.fromFile(file);
await parser.ready();
parser.parse();

Implementation

Future<void> ready() async {
  if (_isReady) {
    return;
  }
  final complater = Completer<void>();
  _isReadyCompleter = complater;
  return complater.future;
}