• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2017 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5import 'dart:async';
6import 'package:flutter/foundation.dart';
7
8List<String> captureOutput(VoidCallback fn) {
9  final List<String> log = <String>[];
10
11  runZoned<void>(fn, zoneSpecification: ZoneSpecification(
12    print: (
13      Zone self,
14      ZoneDelegate parent,
15      Zone zone,
16      String line,
17    ) {
18      log.add(line);
19    },
20  ));
21
22  return log;
23}
24