start method

Future<void> start()

Implementation

Future<void> start() async {
  _process = await (_isFvm
      ? Process.start(
          'fvm', ['flutter', _isAttach ? 'attach' : 'run', ..._proxiedArgs])
      : Process.start(
          'flutter', [_isAttach ? 'attach' : 'run', ..._proxiedArgs]));

  _process.stdout.transform(utf8.decoder).forEach(_processLine);

  _process.stderr.transform(utf8.decoder).forEach(_processError);

  final currentDir = File('.');

  currentDir.watch(recursive: true).listen((event) {
    if (event.path.startsWith('./lib')) {
      if (_throttler == null) {
        _throttler = _runUpdate();
        _throttler?.then((_) {
          print('Sent reload request...');
          _throttler = null;
        });
      }
    }
  });

  stdin.lineMode = false;
  stdin.echoMode = false;
  stdin.transform(utf8.decoder).forEach(_process.stdin.write);
  final exitCode = await _process.exitCode;
  exit(exitCode);
}