22// Use of this source code is governed by a BSD-style license that can be
33// found in the LICENSE file.
44
5+ import 'package:meta/meta.dart' ;
56import 'package:vm_service/vm_service.dart' as vm_service;
67
78import '../base/common.dart' ;
@@ -168,7 +169,7 @@ class ScreenshotCommand extends FlutterCommand {
168169 sink.add (base64.decode (skp.json? ['skp' ] as String ));
169170 await sink.close ();
170171 _showOutputFileInfo (outputFile);
171- _ensureOutputIsNotJsonRpcError (outputFile);
172+ ensureOutputIsNotJsonRpcError (outputFile);
172173 return true ;
173174 }
174175
@@ -192,7 +193,7 @@ class ScreenshotCommand extends FlutterCommand {
192193 sink.add (base64.decode (response.json? ['screenshot' ] as String ));
193194 await sink.close ();
194195 _showOutputFileInfo (outputFile);
195- _ensureOutputIsNotJsonRpcError (outputFile);
196+ ensureOutputIsNotJsonRpcError (outputFile);
196197 return true ;
197198 }
198199
@@ -205,15 +206,16 @@ class ScreenshotCommand extends FlutterCommand {
205206 }
206207 }
207208
208- void _ensureOutputIsNotJsonRpcError (File outputFile) {
209+ @visibleForTesting
210+ static void ensureOutputIsNotJsonRpcError (File outputFile) {
209211 if (outputFile.lengthSync () >= 1000 ) {
210212 return ;
211213 }
212214 final String content = outputFile.readAsStringSync (
213215 encoding: const AsciiCodec (allowInvalid: true ),
214216 );
215217 if (content.startsWith ('{"jsonrpc":"2.0", "error"' )) {
216- throwToolExit ('It appears the output file contains an error message, not valid skia output.' );
218+ throwToolExit ('It appears the output file contains an error message, not valid output.' );
217219 }
218220 }
219221
0 commit comments