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

5
import 'dart:convert' show json;
6
import 'dart:developer' as developer;
7
import 'dart:io' show exit;
8
import 'dart:ui' as ui show SingletonFlutterWindow, Brightness, PlatformDispatcher, window;
9
// Before adding any more dart:ui imports, please read the README.
10

11
import 'package:meta/meta.dart';
12 13 14

import 'assertions.dart';
import 'basic_types.dart';
15
import 'constants.dart';
16
import 'debug.dart';
17
import 'object.dart';
18
import 'platform.dart';
19
import 'print.dart';
20 21 22 23 24 25 26 27

/// Signature for service extensions.
///
/// The returned map must not contain the keys "type" or "method", as
/// they will be replaced before the value is sent to the client. The
/// "type" key will be set to the string `_extensionType` to indicate
/// that this is a return value from a service extension, and the
/// "method" key will be set to the full name of the method.
28
typedef ServiceExtensionCallback = Future<Map<String, dynamic>> Function(Map<String, String> parameters);
29

30 31
/// Base class for mixins that provide singleton services (also known as
/// "bindings").
32
///
33 34 35
/// To use this class in an `on` clause of a mixin, inherit from it and implement
/// [initInstances()]. The mixin is guaranteed to only be constructed once in
/// the lifetime of the app (more precisely, it will assert if constructed twice
36
/// in debug mode).
37
///
38 39 40 41 42 43 44
/// The top-most layer used to write the application will have a concrete class
/// that inherits from [BindingBase] and uses all the various [BindingBase]
/// mixins (such as [ServicesBinding]). For example, the Widgets library in
/// Flutter introduces a binding called [WidgetsFlutterBinding]. The relevant
/// library defines how to create the binding. It could be implied (for example,
/// [WidgetsFlutterBinding] is automatically started from [runApp]), or the
/// application might be required to explicitly call the constructor.
45
abstract class BindingBase {
46 47 48 49 50 51
  /// Default abstract constructor for bindings.
  ///
  /// First calls [initInstances] to have bindings initialize their
  /// instance pointers and other state, then calls
  /// [initServiceExtensions] to have bindings initialize their
  /// observatory service extensions, if any.
52
  BindingBase() {
53 54
    developer.Timeline.startSync('Framework initialization');

55 56 57
    assert(!_debugInitialized);
    initInstances();
    assert(_debugInitialized);
58 59 60 61

    assert(!_debugServiceExtensionsRegistered);
    initServiceExtensions();
    assert(_debugServiceExtensionsRegistered);
62

63
    developer.postEvent('Flutter.FrameworkInitialization', <String, String>{});
64

65
    developer.Timeline.finishSync();
66 67 68
  }

  static bool _debugInitialized = false;
69
  static bool _debugServiceExtensionsRegistered = false;
70

71 72 73 74 75 76 77
  /// Additional configuration used by the framework during hot reload.
  ///
  /// See also:
  ///
  ///  * [DebugReassembleConfig], which describes the configuration.
  static DebugReassembleConfig? debugReassembleConfig;

78
  /// The main window to which this binding is bound.
79
  ///
80 81 82 83
  /// A number of additional bindings are defined as extensions of
  /// [BindingBase], e.g., [ServicesBinding], [RendererBinding], and
  /// [WidgetsBinding]. Each of these bindings define behaviors that interact
  /// with a [ui.SingletonFlutterWindow].
84
  ///
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
  /// Each of these other bindings could individually access a
  /// [ui.SingletonFlutterWindow] statically, but that would preclude the
  /// ability to test its behaviors with a fake window for verification
  /// purposes.  Therefore, [BindingBase] exposes this
  /// [ui.SingletonFlutterWindow] for use by other bindings.  A subclass of
  /// [BindingBase], such as [TestWidgetsFlutterBinding], can override this
  /// accessor to return a different [ui.SingletonFlutterWindow] implementation,
  /// such as a [TestWindow].
  ///
  /// The `window` is a singleton meant for use by applications that only have a
  /// single main window. In addition to the properties of [ui.FlutterWindow],
  /// `window` provides access to platform-specific properties and callbacks
  /// available on the [platformDispatcher].
  ///
  /// For applications designed for more than one main window, prefer using the
  /// [platformDispatcher] to access available views via
  /// [ui.PlatformDispatcher.views].
  ///
  /// However, multiple window support is not yet implemented, so currently this
  /// provides access to the one and only window.
  // TODO(gspencergoog): remove the preceding note once multi-window support is
  // active.
  ui.SingletonFlutterWindow get window => ui.window;

  /// The [ui.PlatformDispatcher] to which this binding is bound.
  ///
  /// A number of additional bindings are defined as extensions of
  /// [BindingBase], e.g., [ServicesBinding], [RendererBinding], and
  /// [WidgetsBinding]. Each of these bindings define behaviors that interact
114 115
  /// with a [ui.PlatformDispatcher], e.g., [ServicesBinding] registers
  /// listeners with the [ChannelBuffers], and [RendererBinding]
116 117 118 119 120 121 122 123 124 125
  /// registers [ui.PlatformDispatcher.onMetricsChanged],
  /// [ui.PlatformDispatcher.onTextScaleFactorChanged],
  /// [ui.PlatformDispatcher.onSemanticsEnabledChanged], and
  /// [ui.PlatformDispatcher.onSemanticsAction] handlers.
  ///
  /// Each of these other bindings could individually access a
  /// [ui.PlatformDispatcher] statically, but that would preclude the ability to
  /// test these behaviors with a fake platform dispatcher for verification
  /// purposes. Therefore, [BindingBase] exposes this [ui.PlatformDispatcher]
  /// for use by other bindings. A subclass of [BindingBase], such as
126
  /// [TestWidgetsFlutterBinding], can override this accessor to return a
127 128
  /// different [ui.PlatformDispatcher] implementation.
  ui.PlatformDispatcher get platformDispatcher => ui.PlatformDispatcher.instance;
129

130 131 132 133
  /// The initialization method. Subclasses override this method to hook into
  /// the platform and otherwise configure their services. Subclasses must call
  /// "super.initInstances()".
  ///
134 135
  /// By convention, if the service is to be provided as a singleton, it should
  /// be exposed as `MixinClassName.instance`, a static getter that returns
136
  /// `MixinClassName._instance`, a static field that is set by
137
  /// `initInstances()`.
138 139
  @protected
  @mustCallSuper
140
  void initInstances() {
141
    assert(!_debugInitialized);
142 143 144 145
    assert(() {
      _debugInitialized = true;
      return true;
    }());
146 147
  }

148 149 150 151 152 153 154 155 156 157 158 159 160
  /// Called when the binding is initialized, to register service
  /// extensions.
  ///
  /// Bindings that want to expose service extensions should overload
  /// this method to register them using calls to
  /// [registerSignalServiceExtension],
  /// [registerBoolServiceExtension],
  /// [registerNumericServiceExtension], and
  /// [registerServiceExtension] (in increasing order of complexity).
  ///
  /// Implementations of this method must call their superclass
  /// implementation.
  ///
161
  /// {@macro flutter.foundation.BindingBase.registerServiceExtension}
162 163 164
  ///
  /// See also:
  ///
165
  ///  * <https://github.com/dart-lang/sdk/blob/main/runtime/vm/service/service.md#rpcs-requests-and-responses>
166 167
  @protected
  @mustCallSuper
168 169
  void initServiceExtensions() {
    assert(!_debugServiceExtensionsRegistered);
170 171 172 173 174 175 176 177 178

    assert(() {
      registerSignalServiceExtension(
        name: 'reassemble',
        callback: reassembleApplication,
      );
      return true;
    }());

179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
    if (!kReleaseMode) {
      if (!kIsWeb) {
        registerSignalServiceExtension(
          name: 'exit',
          callback: _exitApplication,
        );
      }
      // These service extensions are used in profile mode applications.
      registerStringServiceExtension(
        name: 'connectedVmServiceUri',
        getter: () async => connectedVmServiceUri ?? '',
        setter: (String uri) async {
          connectedVmServiceUri = uri;
        },
      );
      registerStringServiceExtension(
        name: 'activeDevToolsServerAddress',
        getter: () async => activeDevToolsServerAddress ?? '',
        setter: (String serverAddress) async {
          activeDevToolsServerAddress = serverAddress;
        },
200 201 202
      );
    }

203
    assert(() {
204
      const String platformOverrideExtensionName = 'platformOverride';
205
      registerServiceExtension(
206
        name: platformOverrideExtensionName,
207 208 209 210 211 212
        callback: (Map<String, String> parameters) async {
          if (parameters.containsKey('value')) {
            switch (parameters['value']) {
              case 'android':
                debugDefaultTargetPlatformOverride = TargetPlatform.android;
                break;
213 214 215
              case 'fuchsia':
                debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
                break;
216 217 218
              case 'iOS':
                debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
                break;
219 220 221
              case 'linux':
                debugDefaultTargetPlatformOverride = TargetPlatform.linux;
                break;
222 223 224
              case 'macOS':
                debugDefaultTargetPlatformOverride = TargetPlatform.macOS;
                break;
225 226
              case 'windows':
                debugDefaultTargetPlatformOverride = TargetPlatform.windows;
227 228 229 230 231
                break;
              case 'default':
              default:
                debugDefaultTargetPlatformOverride = null;
            }
232 233 234 235
            _postExtensionStateChangedEvent(
              platformOverrideExtensionName,
              defaultTargetPlatform.toString().substring('$TargetPlatform.'.length),
            );
236 237
            await reassembleApplication();
          }
238
          return <String, dynamic>{
239 240 241 242
            'value': defaultTargetPlatform
                     .toString()
                     .substring('$TargetPlatform.'.length),
          };
243
        },
244
      );
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262

      const String brightnessOverrideExtensionName = 'brightnessOverride';
      registerServiceExtension(
        name: brightnessOverrideExtensionName,
        callback: (Map<String, String> parameters) async {
          if (parameters.containsKey('value')) {
            switch (parameters['value']) {
              case 'Brightness.light':
                debugBrightnessOverride = ui.Brightness.light;
                break;
              case 'Brightness.dark':
                debugBrightnessOverride = ui.Brightness.dark;
                break;
              default:
                debugBrightnessOverride = null;
            }
            _postExtensionStateChangedEvent(
              brightnessOverrideExtensionName,
263
              (debugBrightnessOverride ?? window.platformBrightness).toString(),
264 265 266 267
            );
            await reassembleApplication();
          }
          return <String, dynamic>{
268
            'value': (debugBrightnessOverride ?? window.platformBrightness).toString(),
269 270 271
          };
        },
      );
272
      return true;
273
    }());
274 275 276 277
    assert(() {
      _debugServiceExtensionsRegistered = true;
      return true;
    }());
278 279
  }

280 281 282 283 284 285 286 287 288 289 290 291 292 293
  /// Whether [lockEvents] is currently locking events.
  ///
  /// Binding subclasses that fire events should check this first, and if it is
  /// set, queue events instead of firing them.
  ///
  /// Events should be flushed when [unlocked] is called.
  @protected
  bool get locked => _lockCount > 0;
  int _lockCount = 0;

  /// Locks the dispatching of asynchronous events and callbacks until the
  /// callback's future completes.
  ///
  /// This causes input lag and should therefore be avoided when possible. It is
294 295 296
  /// primarily intended for use during non-user-interactive time such as to
  /// allow [reassembleApplication] to block input while it walks the tree
  /// (which it partially does asynchronously).
297 298 299
  ///
  /// The [Future] returned by the `callback` argument is returned by [lockEvents].
  @protected
300
  Future<void> lockEvents(Future<void> Function() callback) {
301
    final developer.TimelineTask timelineTask = developer.TimelineTask()..start('Lock events');
302

303 304
    assert(callback != null);
    _lockCount += 1;
305
    final Future<void> future = callback();
306
    assert(future != null, 'The lockEvents() callback returned null; it should return a Future<void> that completes when the lock is to expire.');
307 308
    future.whenComplete(() {
      _lockCount -= 1;
309
      if (!locked) {
310
        timelineTask.finish();
311
        unlocked();
312
      }
313 314 315 316 317 318 319 320
    });
    return future;
  }

  /// Called by [lockEvents] when events get unlocked.
  ///
  /// This should flush any events that were queued while [locked] was true.
  @protected
321
  @mustCallSuper
322 323 324 325
  void unlocked() {
    assert(!locked);
  }

326
  /// Cause the entire application to redraw, e.g. after a hot reload.
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343
  ///
  /// This is used by development tools when the application code has changed,
  /// to cause the application to pick up any changed code. It can be triggered
  /// manually by sending the `ext.flutter.reassemble` service extension signal.
  ///
  /// This method is very computationally expensive and should not be used in
  /// production code. There is never a valid reason to cause the entire
  /// application to repaint in production. All aspects of the Flutter framework
  /// know how to redraw when necessary. It is only necessary in development
  /// when the code is literally changed on the fly (e.g. in hot reload) or when
  /// debug flags are being toggled.
  ///
  /// While this method runs, events are locked (e.g. pointer events are not
  /// dispatched).
  ///
  /// Subclasses (binding classes) should override [performReassemble] to react
  /// to this method being called. This method itself should not be overridden.
344
  Future<void> reassembleApplication() {
345 346 347 348
    return lockEvents(performReassemble);
  }

  /// This method is called by [reassembleApplication] to actually cause the
349
  /// application to reassemble, e.g. after a hot reload.
350
  ///
351
  /// Bindings are expected to use this method to re-register anything that uses
352 353 354 355 356 357 358 359
  /// closures, so that they do not keep pointing to old code, and to flush any
  /// caches of previously computed values, in case the new code would compute
  /// them differently. For example, the rendering layer triggers the entire
  /// application to repaint when this is called.
  ///
  /// Do not call this method directly. Instead, use [reassembleApplication].
  @mustCallSuper
  @protected
360
  Future<void> performReassemble() {
361
    FlutterError.resetErrorCount();
362
    return Future<void>.value();
363
  }
364 365 366 367 368

  /// Registers a service extension method with the given name (full
  /// name "ext.flutter.name"), which takes no arguments and returns
  /// no value.
  ///
369
  /// Calls the `callback` callback when the service extension is called.
370
  ///
371
  /// {@macro flutter.foundation.BindingBase.registerServiceExtension}
372
  @protected
373
  void registerSignalServiceExtension({
374 375
    required String name,
    required AsyncCallback callback,
376 377 378 379 380 381
  }) {
    assert(name != null);
    assert(callback != null);
    registerServiceExtension(
      name: name,
      callback: (Map<String, String> parameters) async {
382
        await callback();
383
        return <String, dynamic>{};
384
      },
385 386 387 388 389 390 391 392 393 394
    );
  }

  /// Registers a service extension method with the given name (full
  /// name "ext.flutter.name"), which takes a single argument
  /// "enabled" which can have the value "true" or the value "false"
  /// or can be omitted to read the current value. (Any value other
  /// than "true" is considered equivalent to "false". Other arguments
  /// are ignored.)
  ///
395 396
  /// Calls the `getter` callback to obtain the value when
  /// responding to the service extension method being called.
397
  ///
398 399
  /// Calls the `setter` callback with the new value when the
  /// service extension method is called with a new value.
400
  ///
401
  /// {@macro flutter.foundation.BindingBase.registerServiceExtension}
402
  @protected
403
  void registerBoolServiceExtension({
404 405 406
    required String name,
    required AsyncValueGetter<bool> getter,
    required AsyncValueSetter<bool> setter,
407 408 409 410 411
  }) {
    assert(name != null);
    assert(getter != null);
    assert(setter != null);
    registerServiceExtension(
412
      name: name,
413
      callback: (Map<String, String> parameters) async {
414
        if (parameters.containsKey('enabled')) {
415
          await setter(parameters['enabled'] == 'true');
416 417
          _postExtensionStateChangedEvent(name, await getter() ? 'true' : 'false');
        }
418
        return <String, dynamic>{'enabled': await getter() ? 'true' : 'false'};
419
      },
420 421 422 423 424 425 426 427 428
    );
  }

  /// Registers a service extension method with the given name (full
  /// name "ext.flutter.name"), which takes a single argument with the
  /// same name as the method which, if present, must have a value
  /// that can be parsed by [double.parse], and can be omitted to read
  /// the current value. (Other arguments are ignored.)
  ///
429 430
  /// Calls the `getter` callback to obtain the value when
  /// responding to the service extension method being called.
431
  ///
432 433
  /// Calls the `setter` callback with the new value when the
  /// service extension method is called with a new value.
434
  ///
435
  /// {@macro flutter.foundation.BindingBase.registerServiceExtension}
436
  @protected
437
  void registerNumericServiceExtension({
438 439 440
    required String name,
    required AsyncValueGetter<double> getter,
    required AsyncValueSetter<double> setter,
441 442 443 444 445 446 447
  }) {
    assert(name != null);
    assert(getter != null);
    assert(setter != null);
    registerServiceExtension(
      name: name,
      callback: (Map<String, String> parameters) async {
448
        if (parameters.containsKey(name)) {
449
          await setter(double.parse(parameters[name]!));
450 451
          _postExtensionStateChangedEvent(name, (await getter()).toString());
        }
452
        return <String, dynamic>{name: (await getter()).toString()};
453
      },
454 455 456
    );
  }

457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485
  /// Sends an event when a service extension's state is changed.
  ///
  /// Clients should listen for this event to stay aware of the current service
  /// extension state. Any service extension that manages a state should call
  /// this method on state change.
  ///
  /// `value` reflects the newly updated service extension value.
  ///
  /// This will be called automatically for service extensions registered via
  /// [registerBoolServiceExtension], [registerNumericServiceExtension], or
  /// [registerStringServiceExtension].
  void _postExtensionStateChangedEvent(String name, dynamic value) {
    postEvent(
      'Flutter.ServiceExtensionStateChanged',
      <String, dynamic>{
        'extension': 'ext.flutter.$name',
        'value': value,
      },
    );
  }

  /// All events dispatched by a [BindingBase] use this method instead of
  /// calling [developer.postEvent] directly so that tests for [BindingBase]
  /// can track which events were dispatched by overriding this method.
  @protected
  void postEvent(String eventKind, Map<String, dynamic> eventData) {
    developer.postEvent(eventKind, eventData);
  }

486 487 488 489 490 491 492 493 494 495
  /// Registers a service extension method with the given name (full name
  /// "ext.flutter.name"), which optionally takes a single argument with the
  /// name "value". If the argument is omitted, the value is to be read,
  /// otherwise it is to be set. Returns the current value.
  ///
  /// Calls the `getter` callback to obtain the value when
  /// responding to the service extension method being called.
  ///
  /// Calls the `setter` callback with the new value when the
  /// service extension method is called with a new value.
496
  ///
497
  /// {@macro flutter.foundation.BindingBase.registerServiceExtension}
498
  @protected
499
  void registerStringServiceExtension({
500 501 502
    required String name,
    required AsyncValueGetter<String> getter,
    required AsyncValueSetter<String> setter,
503 504 505 506 507 508 509
  }) {
    assert(name != null);
    assert(getter != null);
    assert(setter != null);
    registerServiceExtension(
      name: name,
      callback: (Map<String, String> parameters) async {
510
        if (parameters.containsKey('value')) {
511
          await setter(parameters['value']!);
512 513
          _postExtensionStateChangedEvent(name, await getter());
        }
514
        return <String, dynamic>{'value': await getter()};
515
      },
516 517 518
    );
  }

519 520 521 522 523 524 525 526 527
  /// Registers a service extension method with the given name (full name
  /// "ext.flutter.name").
  ///
  /// The given callback is called when the extension method is called. The
  /// callback must return a [Future] that either eventually completes to a
  /// return value in the form of a name/value map where the values can all be
  /// converted to JSON using `json.encode()` (see [JsonEncoder]), or fails. In
  /// case of failure, the failure is reported to the remote caller and is
  /// dumped to the logs.
528 529
  ///
  /// The returned map will be mutated.
530
  ///
531
  /// {@template flutter.foundation.BindingBase.registerServiceExtension}
532 533 534 535 536 537 538
  /// A registered service extension can only be activated if the vm-service
  /// is included in the build, which only happens in debug and profile mode.
  /// Although a service extension cannot be used in release mode its code may
  /// still be included in the Dart snapshot and blow up binary size if it is
  /// not wrapped in a guard that allows the tree shaker to remove it (see
  /// sample code below).
  ///
539
  /// {@tool snippet}
540
  /// The following code registers a service extension that is only included in
541
  /// debug builds.
542 543
  ///
  /// ```dart
544 545 546 547 548 549
  /// void myRegistrationFunction() {
  ///   assert(() {
  ///     // Register your service extension here.
  ///     return true;
  ///   }());
  /// }
550
  /// ```
551
  /// {@end-tool}
552
  ///
553
  /// {@tool snippet}
554
  /// A service extension registered with the following code snippet is
555
  /// available in debug and profile mode.
556 557
  ///
  /// ```dart
558
  /// void myRegistrationFunction() {
559 560 561 562 563
  ///   // kReleaseMode is defined in the 'flutter/foundation.dart' package.
  ///   if (!kReleaseMode) {
  ///     // Register your service extension here.
  ///   }
  /// }
564
  /// ```
565
  /// {@end-tool}
566 567 568
  ///
  /// Both guards ensure that Dart's tree shaker can remove the code for the
  /// service extension in release builds.
569
  /// {@endtemplate}
570
  @protected
571
  void registerServiceExtension({
572 573
    required String name,
    required ServiceExtensionCallback callback,
574 575 576 577 578 579
  }) {
    assert(name != null);
    assert(callback != null);
    final String methodName = 'ext.flutter.$name';
    developer.registerExtension(methodName, (String method, Map<String, String> parameters) async {
      assert(method == methodName);
580 581 582 583 584
      assert(() {
        if (debugInstrumentationEnabled)
          debugPrint('service extension method received: $method($parameters)');
        return true;
      }());
585 586 587 588 589 590 591 592 593 594 595

      // VM service extensions are handled as "out of band" messages by the VM,
      // which means they are handled at various times, generally ASAP.
      // Notably, this includes being handled in the middle of microtask loops.
      // While this makes sense for some service extensions (e.g. "dump current
      // stack trace", which explicitly doesn't want to wait for a loop to
      // complete), Flutter extensions need not be handled with such high
      // priority. Further, handling them with such high priority exposes us to
      // the possibility that they're handled in the middle of a frame, which
      // breaks many assertions. As such, we ensure they we run the callbacks
      // on the outer event loop here.
596
      await debugInstrumentAction<void>('Wait for outer event loop', () {
597
        return Future<void>.delayed(Duration.zero);
598
      });
599

600
      late Map<String, dynamic> result;
601 602 603
      try {
        result = await callback(parameters);
      } catch (exception, stack) {
604
        FlutterError.reportError(FlutterErrorDetails(
605 606
          exception: exception,
          stack: stack,
607
          context: ErrorDescription('during a service extension callback for "$method"'),
608
        ));
609
        return developer.ServiceExtensionResponse.error(
610
          developer.ServiceExtensionResponse.extensionError,
611
          json.encode(<String, String>{
612 613
            'exception': exception.toString(),
            'stack': stack.toString(),
614
            'method': method,
615
          }),
616 617
        );
      }
618 619 620
      result['type'] = '_extensionType';
      result['method'] = method;
      return developer.ServiceExtensionResponse.result(json.encode(result));
621 622 623
    });
  }

624
  @override
625
  String toString() => '<${objectRuntimeType(this, 'BindingBase')}>';
626
}
627 628

/// Terminate the Flutter application.
629
Future<void> _exitApplication() async {
630 631
  exit(0);
}
632 633 634 635 636 637 638 639 640 641 642 643 644

/// Additional configuration used for hot reload reassemble optimizations.
///
/// Do not extend, implement, or mixin this class. This may only be instantiated
/// in debug mode.
class DebugReassembleConfig {
  /// Create a new [DebugReassembleConfig].
  ///
  /// Throws a [FlutterError] if this is called in profile or release mode.
  DebugReassembleConfig({
    this.widgetName,
  }) {
    if (!kDebugMode) {
645
      throw FlutterError('Cannot instantiate DebugReassembleConfig in profile or release mode.');
646 647 648 649 650 651
    }
  }

  /// The name of the widget that was modified, or `null` if the change was elsewhere.
  final String? widgetName;
}