anchor.diff:    }
   
     Future<Null> runSkia(File outputFile) async {
  -    final Uri observatoryUri = new Uri(scheme: 'http', host: '127.0.0.1',
  -        port: int.parse(argResults[_kSkia]));
  -    final VMService vmService = await VMService.connect(observatoryUri);
  -    final Map<String, dynamic> skp = await vmService.vm.invokeRpcRaw('_flutter.screenshotSkp');
  -
  +    final Map<String, dynamic> skp = await _invokeVmServiceRpc('_flutter.screenshotSkp');
       outputFile ??= getUniqueFile(fs.currentDirectory, 'flutter', 'skp');
       final IOSink sink = outputFile.openWrite();
       sink.add(base64.decode(skp['skp']));
       await sink.close();
       await showOutputFileInfo(outputFile);
  +    await _ensureOutputIsNotJsonRpcError(outputFile);
  +  }
  +
  +  Future<void> runRasterizer(File outputFile) async {
  +    final Map<String, dynamic> response = await _invokeVmServiceRpc('_flutter.screenshot');
  +    outputFile ??= getUniqueFile(fs.currentDirectory, 'flutter', 'png');
  +    final IOSink sink = outputFile.openWrite();
  +    sink.add(base64.decode(response['screenshot']));
  +    await sink.close();
  +    await showOutputFileInfo(outputFile);
  +    await _ensureOutputIsNotJsonRpcError(outputFile);
  +  }
  +
  +  Future<Map<String, dynamic>> _invokeVmServiceRpc(String method) async {
  +    final Uri observatoryUri = new Uri(scheme: 'http', host: '127.0.0.1',
  +        port: int.parse(argResults[_kObservatoryPort]));
  +    final VMService vmService = await VMService.connect(observatoryUri);
  +    return await vmService.vm.invokeRpcRaw(method);
  +  }
  +
  +  Future<void> _ensureOutputIsNotJsonRpcError(File outputFile) async {
       if (await outputFile.length() < 1000) {
         final String content = await outputFile.readAsString(
           encoding: const AsciiCodec(allowInvalid: true),
  
positive.code: import '../vmservice.dart';
  
  const String _kOut = 'out';
  const String _kSkia = 'skia';
  
  class ScreenshotCommand extends FlutterCommand {
    ScreenshotCommand() {
      argParser.addOption(
        _kOut,
        abbr: 'o',
        help: 'Location to write the screenshot.',
      );
      argParser.addOption(
        _kSkia,
        valueHelp: 'port',
        help: 'Retrieve the last frame rendered by a Flutter app as a Skia picture\n'
          'using the specified observatory port.\n'
          'To find the observatory port number, use "flutter run --verbose"\n'
          'and look for "Forwarded host port ... for Observatory" in the output.'
      );
    }
  
  
negative.code:     if (argResults.wasParsed(_kOut))
        outputFile = fs.file(argResults[_kOut]);
  
      switch (argResults[_kType]) {
        case _kDeviceType:
          return runScreenshot(outputFile);
        case _kSkiaType:
          return runSkia(outputFile);
        case _kRasterizerType:
          return runRasterizer(outputFile);
      }
    }
  
  