render_tree.dart 1.21 KB
Newer Older
Ian Hickson's avatar
Ian Hickson committed
1
// Copyright 2014 The Flutter Authors. All rights reserved.
2 3 4 5 6
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'message.dart';

7
/// A Flutter Driver command that requests a string representation of the render tree.
8
class GetRenderTree extends Command {
9
  /// Create a command to request a string representation of the render tree.
10
  const GetRenderTree({ Duration? timeout }) : super(timeout: timeout);
11

12
  /// Deserializes this command from the value generated by [serialize].
13
  GetRenderTree.deserialize(Map<String, String> json) : super.deserialize(json);
14 15

  @override
16
  String get kind => 'get_render_tree';
17 18
}

19 20
/// A string representation of the render tree, the result of a
/// [FlutterDriver.getRenderTree] method.
21 22
class RenderTree extends Result {
  /// Creates a [RenderTree] object with the given string representation.
23
  const RenderTree(this.tree);
24

25
  /// String representation of the render tree.
26
  final String? tree;
27

28 29
  /// Deserializes the result from JSON.
  static RenderTree fromJson(Map<String, dynamic> json) {
30
    return RenderTree(json['tree'] as String);
31 32 33 34
  }

  @override
  Map<String, dynamic> toJson() => <String, dynamic>{
35
    'tree': tree,
36 37
  };
}