[macOS]when I create a new window using desktop_multi_window, the switching application cuts back to this window, and the newly created window does not display properly

Is there an existing issue for this?

[x] I have searched the existing issues
[X] I have read the guide to filing a bug

Steps to reproduce

Use Mac mini / macOS Monterey 12.6.1
Run application and create new window
When I switch between applications and go back to the sub-window created by the application, the sub-window is directly unresponsive, and I catch any errors, and there are no errors
I tried other versions such as 3.7.7 and didn't have this problem

Expected results
The create child window does not respond
Actual results
You can click to operate, normal interaction
Code sample

code sample
void main(List<String> args) {
  pdebug("@@@@@@@@@@@@ main start");
  if (args.isNotEmpty && args.first == 'multi_window') {
    final arguments = jsonDecode(args[2]);
    final key = arguments['key'];
    switch (key) {
      case 'setting':
        MultiWindowRunner.runMaterialApp(arguments, const SettingHome());
        break;
      case 'chat_history':
        MultiWindowRunner.runMaterialApp(
            arguments,
            ChatHistory(
              chatId: arguments['chat_id'],
              messageId: arguments['message_id'],
            ));
        break;
    }
    return;
  }

  profileDebug = showProfileDebug;
  runZonedGuarded(() async {
    WidgetsFlutterBinding.ensureInitialized();
    await FileDragAndDropChannel.instance.initializedMainView();
    objcetMgr.multiWindowMgr.windowInit();
    runApp(MyApp());
  }, (error, stackTrace) async {
    if (inProduction) {
      await postException(error, stackTrace, userID: objcetMgr.mainUser.id);
    }
  });
}

static void runMaterialApp(dynamic arguments, Widget child) {
    BotToastNavigatorObserver botToastNavigatorObserver =
        BotToastNavigatorObserver();
    pageMgr.register();
    runApp(
      MaterialApp(
        localizationsDelegates: const [
          GlobalMaterialLocalizations.delegate,
          GlobalWidgetsLocalizations.delegate,
          GlobalCupertinoLocalizations.delegate,
        ],
        supportedLocales: const [Locale('zh', 'CN'), Locale('en')],
        debugShowCheckedModeBanner: false,
        builder: (context, widget) {
          return GestureDetector(
            onTap: () {
              FocusScopeNode currentFocus = FocusScope.of(context);
              if (!currentFocus.hasPrimaryFocus &&
                  currentFocus.focusedChild != null) {
                FocusManager.instance.primaryFocus?.unfocus();
              }
            },
            child: MediaQuery(
                data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
                child: BotToastInit()(context, widget)),
          );
        },
        title: appName,
        navigatorObservers: [
          botToastNavigatorObserver,
        ],
        home: ThemeContainer(mainUser: arguments['mainUser'], child: child),
        theme: themeData(),
      ),
    );
  }

Screenshots or Video

Screenshots / Video demonstration
[Upload media here]

Logs
no logs
Flutter Doctor output

 details
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel unknown, 3.7.9, on macOS 12.6.1 21G217 darwin-arm64, locale zh-Hans-CN)
    ! Flutter version 3.7.9 on channel unknown at /Users/melody/Desktop/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
    ! Unknown upstream repository.
      Reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.81.1)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

! Doctor found issues in 2 categories.

@danagbemava-nc Thanks, For this problem, I am really anxious to solve it

Hi @HongWeiChen, desktop_multi_window is a third-party package. Any issues you face using it should be reported on their repo https://github.com/MixinNetwork/flutter-plugins/issues?q=is:issue+is:open+sort:updated-desc
You are also using an older version of flutter. You may upgrade to the latest version of flutter to see if you still experience this issue.
Closing from here as desktop_multi_window is a third-party package and this should be reported on their repo.
Thank you

@danagbemava-nc This may not be an issue with desktop_multi_window, I built a new flutter project that only had the desktop_multi_window plugin and I used it to create new Windows that still caused the illusion of child Windows sticking when switching applications, I found that as soon as I pull the window size, the window will be called to re-render, or as soon as I go to wait for a while, the page will be re-rendered, and desktop_multi_window only does some processing to build the window, without any complex processing logic, this problem should exist in flutter. Not from plugins

I found the problem is in the SRC/scheduler/binding. In the dart, when I send this file to withdraw to a branch node, will no longer appear this problem
code:
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'dart:collection';
import 'dart:developer' show Flow, Timeline, TimelineTask;
import 'dart:ui' show AppLifecycleState, DartPerformanceMode, FramePhase, FrameTiming, PlatformDispatcher, TimingsCallback;
import 'package:collection/collection.dart' show HeapPriorityQueue, PriorityQueue;
import 'package:flutter/foundation.dart';
import 'debug.dart';
import 'priority.dart';
import 'service_extensions.dart';
export 'dart:developer' show Flow;
export 'dart:ui' show AppLifecycleState, FrameTiming, TimingsCallback;
export 'priority.dart' show Priority;
/// Slows down animations by this factor to help in development.
double get timeDilation => _timeDilation;
double _timeDilation = 1.0;
/// If the [SchedulerBinding] has been initialized, setting the time dilation
/// automatically calls [SchedulerBinding.resetEpoch] to ensure that time stamps
/// seen by consumers of the scheduler binding are always increasing.
///
/// It is safe to set this before initializing the binding.
set timeDilation(double value) {
assert(value > 0.0);
if (_timeDilation == value) {
return;
}
// If the binding has been created, we need to resetEpoch first so that we
// capture start of the epoch with the current time dilation.
SchedulerBinding._instance?.resetEpoch();
_timeDilation = value;
}
/// Signature for frame-related callbacks from the scheduler.
///
/// The timeStamp is the number of milliseconds since the beginning of the
/// scheduler's epoch. Use timeStamp to determine how far to advance animation
/// timelines so that all the animations in the system are synchronized to a
/// common time base.
typedef FrameCallback = void Function(Duration timeStamp);
/// Signature for [SchedulerBinding.scheduleTask] callbacks.
///
/// The type argument T is the task's return value. Consider void if the
/// task does not return a value.
typedef TaskCallback = FutureOr Function();
/// Signature for the [SchedulerBinding.schedulingStrategy] callback. Called
/// whenever the system needs to decide whether a task at a given
/// priority needs to be run.
///
/// Return true if a task with the given priority should be executed at this
/// time, false otherwise.
///
/// See also:
///
///  * [defaultSchedulingStrategy], the default [SchedulingStrategy] for [SchedulerBinding.schedulingStrategy].
typedef SchedulingStrategy = bool Function({ required int priority, required SchedulerBinding scheduler });
class _TaskEntry {
_TaskEntry(this.task, this.priority, this.debugLabel, this.flow) {
assert(() {
debugStack = StackTrace.current;
return true;
}());
}
final TaskCallback task;
final int priority;
final String? debugLabel;
final Flow? flow;
late StackTrace debugStack;
final Completer completer = Completer();
void run() {
if (!kReleaseMode) {
Timeline.timeSync(
debugLabel ?? 'Scheduled Task',
() {
completer.complete(task());
},
flow: flow != null ? Flow.step(flow!.id) : null,
);
} else {
completer.complete(task());
}
}
}
class _FrameCallbackEntry {
_FrameCallbackEntry(this.callback, { bool rescheduling = false }) {
assert(() {
if (rescheduling) {
assert(() {
if (debugCurrentCallbackStack == null) {
throw FlutterError.fromParts([
ErrorSummary('scheduleFrameCallback called with rescheduling true, but no callback is in scope.'),
ErrorDescription(
'The "rescheduling" argument should only be set to true if the '
'callback is being reregistered from within the callback itself, '
'and only then if the callback itself is entirely synchronous.',
),
ErrorHint(
'If this is the initial registration of the callback, or if the '
'callback is asynchronous, then do not use the "rescheduling" '
'argument.',
),
]);
}
return true;
}());
debugStack = debugCurrentCallbackStack;
} else {
// TODO(ianh): trim the frames from this library, so that the call to scheduleFrameCallback is the top one
debugStack = StackTrace.current;
}
return true;
}());
}
final FrameCallback callback;
static StackTrace? debugCurrentCallbackStack;
StackTrace? debugStack;
}
/// The various phases that a [SchedulerBinding] goes through during
/// [SchedulerBinding.handleBeginFrame].
///
/// This is exposed by [SchedulerBinding.schedulerPhase].
///
/// The values of this enum are ordered in the same order as the phases occur,
/// so their relative index values can be compared to each other.
///
/// See also:
///
///  * [WidgetsBinding.drawFrame], which pumps the build and rendering pipeline
///    to generate a frame.
enum SchedulerPhase {
/// No frame is being processed. Tasks (scheduled by
/// [SchedulerBinding.scheduleTask]), microtasks (scheduled by
/// [scheduleMicrotask]), [Timer] callbacks, event handlers (e.g. from user
/// input), and other callbacks (e.g. from [Future]s, [Stream]s, and the like)
/// may be executing.
idle,
/// The transient callbacks (scheduled by
/// [SchedulerBinding.scheduleFrameCallback]) are currently executing.
///
/// Typically, these callbacks handle updating objects to new animation
/// states.
///
/// See [SchedulerBinding.handleBeginFrame].
transientCallbacks,
/// Microtasks scheduled during the processing of transient callbacks are
/// current executing.
///
/// This may include, for instance, callbacks from futures resolved during the
/// [transientCallbacks] phase.
midFrameMicrotasks,
/// The persistent callbacks (scheduled by
/// [SchedulerBinding.addPersistentFrameCallback]) are currently executing.
///
/// Typically, this is the build/layout/paint pipeline. See
/// [WidgetsBinding.drawFrame] and [SchedulerBinding.handleDrawFrame].
persistentCallbacks,
/// The post-frame callbacks (scheduled by
/// [SchedulerBinding.addPostFrameCallback]) are currently executing.
///
/// Typically, these callbacks handle cleanup and scheduling of work for the
/// next frame.
///
/// See [SchedulerBinding.handleDrawFrame].
postFrameCallbacks,
}
/// This callback is invoked when a request for [DartPerformanceMode] is disposed.
///
/// See also:
///
/// * [PerformanceModeRequestHandle] for more information on the lifecycle of the handle.
typedef _PerformanceModeCleanupCallback = VoidCallback;
/// An opaque handle that keeps a request for [DartPerformanceMode] active until
/// disposed.
///
/// To create a [PerformanceModeRequestHandle], use [SchedulerBinding.requestPerformanceMode].
/// The component that makes the request is responsible for disposing the handle.
class PerformanceModeRequestHandle {
PerformanceModeRequestHandle._(_PerformanceModeCleanupCallback this._cleanup);
_PerformanceModeCleanupCallback? _cleanup;
/// Call this method to signal to [SchedulerBinding] that a request for a [DartPerformanceMode]
/// is no longer needed.
///
/// This method must only be called once per object.
void dispose() {
assert(_cleanup != null);
_cleanup!();
_cleanup = null;
}
}
/// Scheduler for running the following:
///
/// * Transient callbacks, triggered by the system's
///   [dart:ui.PlatformDispatcher.onBeginFrame] callback, for synchronizing the
///   application's behavior to the system's display. For example, [Ticker]s and
///   [AnimationController]s trigger from these.
///
/// * Persistent callbacks, triggered by the system's
///   [dart:ui.PlatformDispatcher.onDrawFrame] callback, for updating the
///   system's display after transient callbacks have executed. For example, the
///   rendering layer uses this to drive its rendering pipeline.
///
/// * Post-frame callbacks, which are run after persistent callbacks, just
///   before returning from the [dart:ui.PlatformDispatcher.onDrawFrame] callback.
///
/// * Non-rendering tasks, to be run between frames. These are given a
///   priority and are executed in priority order according to a
///   [schedulingStrategy].
mixin SchedulerBinding on BindingBase {
@override
void initInstances() {
super.initInstances();
_instance = this;
if (!kReleaseMode) {
  addTimingsCallback((List<FrameTiming> timings) {
    timings.forEach(_profileFramePostEvent);
  });
}

}
/// The current [SchedulerBinding], if one has been created.
///
/// Provides access to the features exposed by this mixin. The binding must
/// be initialized before using this getter; this is typically done by calling
/// [runApp] or [WidgetsFlutterBinding.ensureInitialized].
static SchedulerBinding get instance => BindingBase.checkInstance(_instance);
static SchedulerBinding? _instance;
final List _timingsCallbacks = [];
/// Add a [TimingsCallback] that receives [FrameTiming] sent from
/// the engine.
///
/// This API enables applications to monitor their graphics
/// performance. Data from the engine is batched into lists of
/// [FrameTiming] objects which are reported approximately once a
/// second in release mode and approximately once every 100ms in
/// debug and profile builds. The list is sorted in ascending
/// chronological order (earliest frame first). The timing of the
/// first frame is sent immediately without batching.
///
/// The data returned can be used to catch missed frames (by seeing
/// if [FrameTiming.buildDuration] or [FrameTiming.rasterDuration]
/// exceed the frame budget, e.g. 16ms at 60Hz), and to catch high
/// latency (by seeing if [FrameTiming.totalSpan] exceeds the frame
/// budget). It is possible for no frames to be missed but for the
/// latency to be more than one frame in the case where the Flutter
/// engine is pipelining the graphics updates, e.g. because the sum
/// of the [FrameTiming.buildDuration] and the
/// [FrameTiming.rasterDuration] together exceed the frame budget.
/// In those cases, animations will be smooth but touch input will
/// feel more sluggish.
///
/// Using [addTimingsCallback] is preferred over using
/// [dart:ui.PlatformDispatcher.onReportTimings] directly because the
/// [dart:ui.PlatformDispatcher.onReportTimings] API only allows one callback,
/// which prevents multiple libraries from registering listeners
/// simultaneously, while this API allows multiple callbacks to be registered
/// independently.
///
/// This API is implemented in terms of
/// [dart:ui.PlatformDispatcher.onReportTimings]. In release builds, when no
/// libraries have registered with this API, the
/// [dart:ui.PlatformDispatcher.onReportTimings] callback is not set, which
/// disables the performance tracking and reduces the runtime overhead to
/// approximately zero. The performance overhead of the performance tracking
/// when one or more callbacks are registered (i.e. when it is enabled) is
/// very approximately 0.01% CPU usage per second (measured on an iPhone 6s).
///
/// In debug and profile builds, the [SchedulerBinding] itself
/// registers a timings callback to update the [Timeline].
///
/// If the same callback is added twice, it will be executed twice.
///
/// See also:
///
///  * [removeTimingsCallback], which can be used to remove a callback
///    added using this method.
void addTimingsCallback(TimingsCallback callback) {
_timingsCallbacks.add(callback);
if (_timingsCallbacks.length == 1) {
assert(platformDispatcher.onReportTimings == null);
platformDispatcher.onReportTimings = _executeTimingsCallbacks;
}
assert(platformDispatcher.onReportTimings == _executeTimingsCallbacks);
}
/// Removes a callback that was earlier added by [addTimingsCallback].
void removeTimingsCallback(TimingsCallback callback) {
assert(_timingsCallbacks.contains(callback));
_timingsCallbacks.remove(callback);
if (_timingsCallbacks.isEmpty) {
platformDispatcher.onReportTimings = null;
}
}
@pragma('vm:notify-debugger-on-exception')
void _executeTimingsCallbacks(List timings) {
final List clonedCallbacks =
List.of(_timingsCallbacks);
for (final TimingsCallback callback in clonedCallbacks) {
try {
if (_timingsCallbacks.contains(callback)) {
callback(timings);
}
} catch (exception, stack) {
InformationCollector? collector;
assert(() {
collector = () => [
DiagnosticsProperty(
'The TimingsCallback that gets executed was',
callback,
style: DiagnosticsTreeStyle.errorProperty,
),
];
return true;
}());
FlutterError.reportError(FlutterErrorDetails(
exception: exception,
stack: stack,
context: ErrorDescription('while executing callbacks for FrameTiming'),
informationCollector: collector,
));
}
}
}
@override
void initServiceExtensions() {
super.initServiceExtensions();
if (!kReleaseMode) {
  registerNumericServiceExtension(
    name: SchedulerServiceExtensions.timeDilation.name,
    getter: () async => timeDilation,
    setter: (double value) async {
      timeDilation = value;
    },
  );
}

}
/// Whether the application is visible, and if so, whether it is currently
/// interactive.
///
/// This is set by [handleAppLifecycleStateChanged] when the
/// [SystemChannels.lifecycle] notification is dispatched.
///
/// The preferred ways to watch for changes to this value are using
/// [WidgetsBindingObserver.didChangeAppLifecycleState], or through an
/// [AppLifecycleListener] object.
AppLifecycleState? get lifecycleState => _lifecycleState;
AppLifecycleState? _lifecycleState;
/// Allows the test framework to reset the lifecycle state back to its
/// initial value.
@visibleForTesting
void resetLifecycleState() {
_lifecycleState = null;
}
/// Called when the application lifecycle state changes.
///
/// Notifies all the observers using
/// [WidgetsBindingObserver.didChangeAppLifecycleState].
///
/// This method exposes notifications from [SystemChannels.lifecycle].
@protected
@mustCallSuper
void handleAppLifecycleStateChanged(AppLifecycleState state) {
if (lifecycleState == state) {
return;
}
_lifecycleState = state;
switch (state) {
case AppLifecycleState.resumed:
case AppLifecycleState.inactive:
_setFramesEnabledState(true);
case AppLifecycleState.hidden:
case AppLifecycleState.paused:
case AppLifecycleState.detached:
_setFramesEnabledState(false);
}
}
/// The strategy to use when deciding whether to run a task or not.
///
/// Defaults to [defaultSchedulingStrategy].
SchedulingStrategy schedulingStrategy = defaultSchedulingStrategy;
static int _taskSorter (_TaskEntry e1, _TaskEntry e2) {
return -e1.priority.compareTo(e2.priority);
}
final PriorityQueue<_TaskEntry> _taskQueue = HeapPriorityQueue<_TaskEntry>(_taskSorter);
/// Schedules the given task with the given priority.
///
/// If task returns a future, the future returned by [scheduleTask] will
/// complete after the former future has been scheduled to completion.
/// Otherwise, the returned future for [scheduleTask] will complete with the
/// same value returned by task after it has been scheduled.
///
/// The debugLabel and flow are used to report the task to the [Timeline],
/// for use when profiling.
///
/// ## Processing model
///
/// Tasks will be executed between frames, in priority order,
/// excluding tasks that are skipped by the current
/// [schedulingStrategy]. Tasks should be short (as in, up to a
/// millisecond), so as to not cause the regular frame callbacks to
/// get delayed.
///
/// If an animation is running, including, for instance, a [ProgressIndicator]
/// indicating that there are pending tasks, then tasks with a priority below
/// [Priority.animation] won't run (at least, not with the
/// [defaultSchedulingStrategy]; this can be configured using
/// [schedulingStrategy]).
Future scheduleTask(
TaskCallback task,
Priority priority, {
String? debugLabel,
Flow? flow,
}) {
final bool isFirstTask = _taskQueue.isEmpty;
final _TaskEntry entry = _TaskEntry(
task,
priority.value,
debugLabel,
flow,
);
_taskQueue.add(entry);
if (isFirstTask && !locked) {
_ensureEventLoopCallback();
}
return entry.completer.future;
}
@override
void unlocked() {
super.unlocked();
if (_taskQueue.isNotEmpty) {
_ensureEventLoopCallback();
}
}
// Whether this scheduler already requested to be called from the event loop.
bool _hasRequestedAnEventLoopCallback = false;
// Ensures that the scheduler services a task scheduled by
// [SchedulerBinding.scheduleTask].
void _ensureEventLoopCallback() {
assert(!locked);
assert(_taskQueue.isNotEmpty);
if (_hasRequestedAnEventLoopCallback) {
return;
}
_hasRequestedAnEventLoopCallback = true;
Timer.run(_runTasks);
}
// Scheduled by _ensureEventLoopCallback.
void _runTasks() {
_hasRequestedAnEventLoopCallback = false;
if (handleEventLoopCallback()) {
_ensureEventLoopCallback();
} // runs next task when there's time
}
/// Execute the highest-priority task, if it is of a high enough priority.
///
/// Returns true if a task was executed and there are other tasks remaining
/// (even if they are not high-enough priority).
///
/// Returns false if no task was executed, which can occur if there are no
/// tasks scheduled, if the scheduler is [locked], or if the highest-priority
/// task is of too low a priority given the current [schedulingStrategy].
///
/// Also returns false if there are no tasks remaining.
@visibleForTesting
@pragma('vm:notify-debugger-on-exception')
bool handleEventLoopCallback() {
if (_taskQueue.isEmpty || locked) {
return false;
}
final _TaskEntry entry = _taskQueue.first;
if (schedulingStrategy(priority: entry.priority, scheduler: this)) {
try {
_taskQueue.removeFirst();
entry.run();
} catch (exception, exceptionStack) {
StackTrace? callbackStack;
assert(() {
callbackStack = entry.debugStack;
return true;
}());
FlutterError.reportError(FlutterErrorDetails(
exception: exception,
stack: exceptionStack,
library: 'scheduler library',
context: ErrorDescription('during a task callback'),
informationCollector: (callbackStack == null) ? null : () {
return [
DiagnosticsStackTrace(
'\nThis exception was thrown in the context of a scheduler callback. '
'When the scheduler callback was registered (as opposed to when the '
'exception was thrown), this was the stack',
callbackStack,
),
];
},
));
}
return _taskQueue.isNotEmpty;
}
return false;
}
int _nextFrameCallbackId = 0; // positive
Map<int, _FrameCallbackEntry> _transientCallbacks = <int, _FrameCallbackEntry>{};
final Set _removedIds = HashSet();
/// The current number of transient frame callbacks scheduled.
///
/// This is reset to zero just before all the currently scheduled
/// transient callbacks are called, at the start of a frame.
///
/// This number is primarily exposed so that tests can verify that
/// there are no unexpected transient callbacks still registered
/// after a test's resources have been gracefully disposed.
int get transientCallbackCount => _transientCallbacks.length;
/// Schedules the given transient frame callback.
///
/// Adds the given callback to the list of frame callbacks and ensures that a
/// frame is scheduled.
///
/// If this is a one-off registration, ignore the rescheduling argument.
///
/// If this is a callback that will be re-registered each time it fires, then
/// when you re-register the callback, set the rescheduling argument to
/// true. This has no effect in release builds, but in debug builds, it
/// ensures that the stack trace that is stored for this callback is the
/// original stack trace for when the callback was first registered, rather
/// than the stack trace for when the callback is re-registered. This makes it
/// easier to track down the original reason that a particular callback was
/// called. If rescheduling is true, the call must be in the context of a
/// frame callback.
///
/// Callbacks registered with this method can be canceled using
/// [cancelFrameCallbackWithId].
int scheduleFrameCallback(FrameCallback callback, { bool rescheduling = false }) {
scheduleFrame();
_nextFrameCallbackId += 1;
_transientCallbacks[_nextFrameCallbackId] = _FrameCallbackEntry(callback, rescheduling: rescheduling);
return _nextFrameCallbackId;
}
/// Cancels the transient frame callback with the given [id].
///
/// Removes the given callback from the list of frame callbacks. If a frame
/// has been requested, this does not also cancel that request.
///
/// Transient frame callbacks are those registered using
/// [scheduleFrameCallback].
void cancelFrameCallbackWithId(int id) {
assert(id > 0);
_transientCallbacks.remove(id);
_removedIds.add(id);
}
/// Asserts that there are no registered transient callbacks; if
/// there are, prints their locations and throws an exception.
///
/// A transient frame callback is one that was registered with
/// [scheduleFrameCallback].
///
/// This is expected to be called at the end of tests (the
/// flutter_test framework does it automatically in normal cases).
///
/// Call this method when you expect there to be no transient
/// callbacks registered, in an assert statement with a message that
/// you want printed when a transient callback is registered:
///
/// dart   /// assert(SchedulerBinding.instance.debugAssertNoTransientCallbacks(   ///   'A leak of transient callbacks was detected while doing foo.'   /// ));   ///
///
/// Does nothing if asserts are disabled. Always returns true.
bool debugAssertNoTransientCallbacks(String reason) {
assert(() {
if (transientCallbackCount > 0) {
// We cache the values so that we can produce them later
// even if the information collector is called after
// the problem has been resolved.
final int count = transientCallbackCount;
final Map<int, _FrameCallbackEntry> callbacks = Map<int, _FrameCallbackEntry>.of(_transientCallbacks);
FlutterError.reportError(FlutterErrorDetails(
exception: reason,
library: 'scheduler library',
informationCollector: () => [
if (count == 1)
// TODO(jacobr): I have added an extra line break in this case.
ErrorDescription(
'There was one transient callback left. '
'The stack trace for when it was registered is as follows:',
)
else
ErrorDescription(
'There were $count transient callbacks left. '
'The stack traces for when they were registered are as follows:',
),
for (final int id in callbacks.keys)
DiagnosticsStackTrace('── callback $id ──', callbacks[id]!.debugStack, showSeparator: false),
],
));
}
return true;
}());
return true;
}
/// Asserts that there are no pending performance mode requests in debug mode.
///
/// Throws a [FlutterError] if there are pending performance mode requests,
/// as this indicates a potential memory leak.
bool debugAssertNoPendingPerformanceModeRequests(String reason) {
assert(() {
if (_performanceMode != null) {
throw FlutterError(reason);
}
return true;
}());
return true;
}
/// Asserts that there is no artificial time dilation in debug mode.
///
/// Throws a [FlutterError] if there are such dilation, as this will make
/// subsequent tests see dilation and thus flaky.
bool debugAssertNoTimeDilation(String reason) {
assert(() {
if (timeDilation != 1.0) {
throw FlutterError(reason);
}
return true;
}());
return true;
}
/// Prints the stack for where the current transient callback was registered.
///
/// A transient frame callback is one that was registered with
/// [scheduleFrameCallback].
///
/// When called in debug more and in the context of a transient callback, this
/// function prints the stack trace from where the current transient callback
/// was registered (i.e. where it first called [scheduleFrameCallback]).
///
/// When called in debug mode in other contexts, it prints a message saying
/// that this function was not called in the context a transient callback.
///
/// In release mode, this function does nothing.
///
/// To call this function, use the following code:
///
/// dart   /// SchedulerBinding.debugPrintTransientCallbackRegistrationStack();   ///
static void debugPrintTransientCallbackRegistrationStack() {
assert(() {
if (_FrameCallbackEntry.debugCurrentCallbackStack != null) {
debugPrint('When the current transient callback was registered, this was the stack:');
debugPrint(
FlutterError.defaultStackFilter(
FlutterError.demangleStackTrace(
_FrameCallbackEntry.debugCurrentCallbackStack!,
).toString().trimRight().split('\n'),
).join('\n'),
);
} else {
debugPrint('No transient callback is currently executing.');
}
return true;
}());
}
final List _persistentCallbacks = [];
/// Adds a persistent frame callback.
///
/// Persistent callbacks are called after transient
/// (non-persistent) frame callbacks.
///
/// Does not request a new frame. Conceptually, persistent frame
/// callbacks are observers of "begin frame" events. Since they are
/// executed after the transient frame callbacks they can drive the
/// rendering pipeline.
///
/// Persistent frame callbacks cannot be unregistered. Once registered, they
/// are called for every frame for the lifetime of the application.
void addPersistentFrameCallback(FrameCallback callback) {
_persistentCallbacks.add(callback);
}
final List _postFrameCallbacks = [];
/// Schedule a callback for the end of this frame.
///
/// The provided callback is run immediately after a frame, just after the
/// persistent frame callbacks (which is when the main rendering pipeline has
/// been flushed).
///
/// This method does not request a new frame. If a frame is already in
/// progress and the execution of post-frame callbacks has not yet begun, then
/// the registered callback is executed at the end of the current frame.
/// Otherwise, the registered callback is executed after the next frame
/// (whenever that may be, if ever).
///
/// The callbacks are executed in the order in which they have been
/// added.
///
/// Post-frame callbacks cannot be unregistered. They are called exactly once.
///
/// See also:
///
///  * [scheduleFrameCallback], which registers a callback for the start of
///    the next frame.
void addPostFrameCallback(FrameCallback callback) {
_postFrameCallbacks.add(callback);
}
Completer? _nextFrameCompleter;
/// Returns a Future that completes after the frame completes.
///
/// If this is called between frames, a frame is immediately scheduled if
/// necessary. If this is called during a frame, the Future completes after
/// the current frame.
///
/// If the device's screen is currently turned off, this may wait a very long
/// time, since frames are not scheduled while the device's screen is turned
/// off.
Future get endOfFrame {
if (_nextFrameCompleter == null) {
if (schedulerPhase == SchedulerPhase.idle) {
scheduleFrame();
}
_nextFrameCompleter = Completer();
addPostFrameCallback((Duration timeStamp) {
_nextFrameCompleter!.complete();
_nextFrameCompleter = null;
});
}
return _nextFrameCompleter!.future;
}
/// Whether this scheduler has requested that [handleBeginFrame] be called soon.
bool get hasScheduledFrame => _hasScheduledFrame;
bool _hasScheduledFrame = false;
/// The phase that the scheduler is currently operating under.
SchedulerPhase get schedulerPhase => _schedulerPhase;
SchedulerPhase _schedulerPhase = SchedulerPhase.idle;
/// Whether frames are currently being scheduled when [scheduleFrame] is called.
///
/// This value depends on the value of the [lifecycleState].
bool get framesEnabled => _framesEnabled;
bool _framesEnabled = true;
void _setFramesEnabledState(bool enabled) {
if (_framesEnabled == enabled) {
return;
}
_framesEnabled = enabled;
if (enabled) {
scheduleFrame();
}
}
/// Ensures callbacks for [PlatformDispatcher.onBeginFrame] and
/// [PlatformDispatcher.onDrawFrame] are registered.
@protected
void ensureFrameCallbacksRegistered() {
platformDispatcher.onBeginFrame ??= _handleBeginFrame;
platformDispatcher.onDrawFrame ??= _handleDrawFrame;
}
/// Schedules a new frame using [scheduleFrame] if this object is not
/// currently producing a frame.
///
/// Calling this method ensures that [handleDrawFrame] will eventually be
/// called, unless it's already in progress.
///
/// This has no effect if [schedulerPhase] is
/// [SchedulerPhase.transientCallbacks] or [SchedulerPhase.midFrameMicrotasks]
/// (because a frame is already being prepared in that case), or
/// [SchedulerPhase.persistentCallbacks] (because a frame is actively being
/// rendered in that case). It will schedule a frame if the [schedulerPhase]
/// is [SchedulerPhase.idle] (in between frames) or
/// [SchedulerPhase.postFrameCallbacks] (after a frame).
void ensureVisualUpdate() {
switch (schedulerPhase) {
case SchedulerPhase.idle:
case SchedulerPhase.postFrameCallbacks:
scheduleFrame();
return;
case SchedulerPhase.transientCallbacks:
case SchedulerPhase.midFrameMicrotasks:
case SchedulerPhase.persistentCallbacks:
return;
}
}
/// If necessary, schedules a new frame by calling
/// [dart:ui.PlatformDispatcher.scheduleFrame].
///
/// After this is called, the engine will (eventually) call
/// [handleBeginFrame]. (This call might be delayed, e.g. if the device's
/// screen is turned off it will typically be delayed until the screen is on
/// and the application is visible.) Calling this during a frame forces
/// another frame to be scheduled, even if the current frame has not yet
/// completed.
///
/// Scheduled frames are serviced when triggered by a "Vsync" signal provided
/// by the operating system. The "Vsync" signal, or vertical synchronization
/// signal, was historically related to the display refresh, at a time when
/// hardware physically moved a beam of electrons vertically between updates
/// of the display. The operation of contemporary hardware is somewhat more
/// subtle and complicated, but the conceptual "Vsync" refresh signal continue
/// to be used to indicate when applications should update their rendering.
///
/// To have a stack trace printed to the console any time this function
/// schedules a frame, set [debugPrintScheduleFrameStacks] to true.
///
/// See also:
///
///  * [scheduleForcedFrame], which ignores the [lifecycleState] when
///    scheduling a frame.
///  * [scheduleWarmUpFrame], which ignores the "Vsync" signal entirely and
///    triggers a frame immediately.
void scheduleFrame() {
if (_hasScheduledFrame || !framesEnabled) {
return;
}
assert(() {
if (debugPrintScheduleFrameStacks) {
debugPrintStack(label: 'scheduleFrame() called. Current phase is $schedulerPhase.');
}
return true;
}());
ensureFrameCallbacksRegistered();
platformDispatcher.scheduleFrame();
_hasScheduledFrame = true;
}
/// Schedules a new frame by calling
/// [dart:ui.PlatformDispatcher.scheduleFrame].
///
/// After this is called, the engine will call [handleBeginFrame], even if
/// frames would normally not be scheduled by [scheduleFrame] (e.g. even if
/// the device's screen is turned off).
///
/// The framework uses this to force a frame to be rendered at the correct
/// size when the phone is rotated, so that a correctly-sized rendering is
/// available when the screen is turned back on.
///
/// To have a stack trace printed to the console any time this function
/// schedules a frame, set [debugPrintScheduleFrameStacks] to true.
///
/// Prefer using [scheduleFrame] unless it is imperative that a frame be
/// scheduled immediately, since using [scheduleForcedFrame] will cause
/// significantly higher battery usage when the device should be idle.
///
/// Consider using [scheduleWarmUpFrame] instead if the goal is to update the
/// rendering as soon as possible (e.g. at application startup).
void scheduleForcedFrame() {
if (_hasScheduledFrame) {
return;
}
assert(() {
if (debugPrintScheduleFrameStacks) {
debugPrintStack(label: 'scheduleForcedFrame() called. Current phase is $schedulerPhase.');
}
return true;
}());
ensureFrameCallbacksRegistered();
platformDispatcher.scheduleFrame();
_hasScheduledFrame = true;
}
bool _warmUpFrame = false;
/// Schedule a frame to run as soon as possible, rather than waiting for
/// the engine to request a frame in response to a system "Vsync" signal.
///
/// This is used during application startup so that the first frame (which is
/// likely to be quite expensive) gets a few extra milliseconds to run.
///
/// Locks events dispatching until the scheduled frame has completed.
///
/// If a frame has already been scheduled with [scheduleFrame] or
/// [scheduleForcedFrame], this call may delay that frame.
///
/// If any scheduled frame has already begun or if another
/// [scheduleWarmUpFrame] was already called, this call will be ignored.
///
/// Prefer [scheduleFrame] to update the display in normal operation.
void scheduleWarmUpFrame() {
if (_warmUpFrame || schedulerPhase != SchedulerPhase.idle) {
return;
}
_warmUpFrame = true;
final TimelineTask timelineTask = TimelineTask()..start('Warm-up frame');
final bool hadScheduledFrame = _hasScheduledFrame;
// We use timers here to ensure that microtasks flush in between.
Timer.run(() {
  assert(_warmUpFrame);
  handleBeginFrame(null);
});
Timer.run(() {
  assert(_warmUpFrame);
  handleDrawFrame();
  // We call resetEpoch after this frame so that, in the hot reload case,
  // the very next frame pretends to have occurred immediately after this
  // warm-up frame. The warm-up frame's timestamp will typically be far in
  // the past (the time of the last real frame), so if we didn't reset the
  // epoch we would see a sudden jump from the old time in the warm-up frame
  // to the new time in the "real" frame. The biggest problem with this is
  // that implicit animations end up being triggered at the old time and
  // then skipping every frame and finishing in the new time.
  resetEpoch();
  _warmUpFrame = false;
  if (hadScheduledFrame) {
    scheduleFrame();
  }
});

// Lock events so touch events etc don't insert themselves until the
// scheduled frame has finished.
lockEvents(() async {
  await endOfFrame;
  timelineTask.finish();
});

}
Duration? _firstRawTimeStampInEpoch;
Duration _epochStart = Duration.zero;
Duration _lastRawTimeStamp = Duration.zero;
/// Prepares the scheduler for a non-monotonic change to how time stamps are
/// calculated.
///
/// Callbacks received from the scheduler assume that their time stamps are
/// monotonically increasing. The raw time stamp passed to [handleBeginFrame]
/// is monotonic, but the scheduler might adjust those time stamps to provide
/// [timeDilation]. Without careful handling, these adjusts could cause time
/// to appear to run backwards.
///
/// The [resetEpoch] function ensures that the time stamps are monotonic by
/// resetting the base time stamp used for future time stamp adjustments to the
/// current value. For example, if the [timeDilation] decreases, rather than
/// scaling down the [Duration] since the beginning of time, [resetEpoch] will
/// ensure that we only scale down the duration since [resetEpoch] was called.
///
/// Setting [timeDilation] calls [resetEpoch] automatically. You don't need to
/// call [resetEpoch] yourself.
void resetEpoch() {
_epochStart = _adjustForEpoch(_lastRawTimeStamp);
_firstRawTimeStampInEpoch = null;
}
/// Adjusts the given time stamp into the current epoch.
///
/// This both offsets the time stamp to account for when the epoch started
/// (both in raw time and in the epoch's own time line) and scales the time
/// stamp to reflect the time dilation in the current epoch.
///
/// These mechanisms together combine to ensure that the durations we give
/// during frame callbacks are monotonically increasing.
Duration _adjustForEpoch(Duration rawTimeStamp) {
final Duration rawDurationSinceEpoch = _firstRawTimeStampInEpoch == null ? Duration.zero : rawTimeStamp - _firstRawTimeStampInEpoch!;
return Duration(microseconds: (rawDurationSinceEpoch.inMicroseconds / timeDilation).round() + _epochStart.inMicroseconds);
}
/// The time stamp for the frame currently being processed.
///
/// This is only valid while between the start of [handleBeginFrame] and the
/// end of the corresponding [handleDrawFrame], i.e. while a frame is being
/// produced.
Duration get currentFrameTimeStamp {
assert(_currentFrameTimeStamp != null);
return _currentFrameTimeStamp!;
}
Duration? _currentFrameTimeStamp;
/// The raw time stamp as provided by the engine to
/// [dart:ui.PlatformDispatcher.onBeginFrame] for the frame currently being
/// processed.
///
/// Unlike [currentFrameTimeStamp], this time stamp is neither adjusted to
/// offset when the epoch started nor scaled to reflect the [timeDilation] in
/// the current epoch.
///
/// On most platforms, this is a more or less arbitrary value, and should
/// generally be ignored. On Fuchsia, this corresponds to the system-provided
/// presentation time, and can be used to ensure that animations running in
/// different processes are synchronized.
Duration get currentSystemFrameTimeStamp {
return _lastRawTimeStamp;
}
int _debugFrameNumber = 0;
String? _debugBanner;
// Whether the current engine frame needs to be postponed till after the
// warm-up frame.
//
// Engine may begin a frame in the middle of the warm-up frame because the
// warm-up frame is scheduled by timers while the engine frame is scheduled
// by platform specific frame scheduler (e.g. requestAnimationFrame on the
// web). When this happens, we let the warm-up frame finish, and postpone the
// engine frame.
bool _rescheduleAfterWarmUpFrame = false;
void _handleBeginFrame(Duration rawTimeStamp) {
if (_warmUpFrame) {
// "begin frame" and "draw frame" must strictly alternate. Therefore
// _rescheduleAfterWarmUpFrame cannot possibly be true here as it is
// reset by _handleDrawFrame.
assert(!_rescheduleAfterWarmUpFrame);
_rescheduleAfterWarmUpFrame = true;
return;
}
handleBeginFrame(rawTimeStamp);
}
void _handleDrawFrame() {
if (_rescheduleAfterWarmUpFrame) {
_rescheduleAfterWarmUpFrame = false;
// Reschedule in a post-frame callback to allow the draw-frame phase of
// the warm-up frame to finish.
addPostFrameCallback((Duration timeStamp) {
// Force an engine frame.
//
// We need to reset _hasScheduledFrame here because we cancelled the
// original engine frame, and therefore did not run handleBeginFrame
// who is responsible for resetting it. So if a frame callback set this
// to true in the "begin frame" part of the warm-up frame, it will
// still be true here and cause us to skip scheduling an engine frame.
_hasScheduledFrame = false;
scheduleFrame();
});
return;
}
handleDrawFrame();
}
final TimelineTask? _frameTimelineTask = kReleaseMode ? null : TimelineTask();
/// Called by the engine to prepare the framework to produce a new frame.
///
/// This function calls all the transient frame callbacks registered by
/// [scheduleFrameCallback]. It then returns, any scheduled microtasks are run
/// (e.g. handlers for any [Future]s resolved by transient frame callbacks),
/// and [handleDrawFrame] is called to continue the frame.
///
/// If the given time stamp is null, the time stamp from the last frame is
/// reused.
///
/// To have a banner shown at the start of every frame in debug mode, set
/// [debugPrintBeginFrameBanner] to true. The banner will be printed to the
/// console using [debugPrint] and will contain the frame number (which
/// increments by one for each frame), and the time stamp of the frame. If the
/// given time stamp was null, then the string "warm-up frame" is shown
/// instead of the time stamp. This allows frames eagerly pushed by the
/// framework to be distinguished from those requested by the engine in
/// response to the "Vsync" signal from the operating system.
///
/// You can also show a banner at the end of every frame by setting
/// [debugPrintEndFrameBanner] to true. This allows you to distinguish log
/// statements printed during a frame from those printed between frames (e.g.
/// in response to events or timers).
void handleBeginFrame(Duration? rawTimeStamp) {
_frameTimelineTask?.start('Frame');
_firstRawTimeStampInEpoch ??= rawTimeStamp;
_currentFrameTimeStamp = _adjustForEpoch(rawTimeStamp ?? _lastRawTimeStamp);
if (rawTimeStamp != null) {
_lastRawTimeStamp = rawTimeStamp;
}
assert(() {
  _debugFrameNumber += 1;

  if (debugPrintBeginFrameBanner || debugPrintEndFrameBanner) {
    final StringBuffer frameTimeStampDescription = StringBuffer();
    if (rawTimeStamp != null) {
      _debugDescribeTimeStamp(_currentFrameTimeStamp!, frameTimeStampDescription);
    } else {
      frameTimeStampDescription.write('(warm-up frame)');
    }
    _debugBanner = '▄▄▄▄▄▄▄▄ Frame ${_debugFrameNumber.toString().padRight(7)}   ${frameTimeStampDescription.toString().padLeft(18)} ▄▄▄▄▄▄▄▄';
    if (debugPrintBeginFrameBanner) {
      debugPrint(_debugBanner);
    }
  }
  return true;
}());

assert(schedulerPhase == SchedulerPhase.idle);
_hasScheduledFrame = false;
try {
  // TRANSIENT FRAME CALLBACKS
  _frameTimelineTask?.start('Animate');
  _schedulerPhase = SchedulerPhase.transientCallbacks;
  final Map<int, _FrameCallbackEntry> callbacks = _transientCallbacks;
  _transientCallbacks = <int, _FrameCallbackEntry>{};
  callbacks.forEach((int id, _FrameCallbackEntry callbackEntry) {
    if (!_removedIds.contains(id)) {
      _invokeFrameCallback(callbackEntry.callback, _currentFrameTimeStamp!, callbackEntry.debugStack);
    }
  });
  _removedIds.clear();
} finally {
  _schedulerPhase = SchedulerPhase.midFrameMicrotasks;
}

}
DartPerformanceMode? _performanceMode;
int _numPerformanceModeRequests = 0;
/// Request a specific [DartPerformanceMode].
///
/// Returns null if the request was not successful due to conflicting performance mode requests.
/// Two requests are said to be in conflict if they are not of the same [DartPerformanceMode] type,
/// and an explicit request for a performance mode has been made prior.
///
/// Requestor is responsible for calling [PerformanceModeRequestHandle.dispose] when it no longer
/// requires the performance mode.
PerformanceModeRequestHandle? requestPerformanceMode(DartPerformanceMode mode) {
// conflicting requests are not allowed.
if (_performanceMode != null && _performanceMode != mode) {
return null;
}
if (_performanceMode == mode) {
  assert(_numPerformanceModeRequests > 0);
  _numPerformanceModeRequests++;
} else if (_performanceMode == null) {
  assert(_numPerformanceModeRequests == 0);
  _performanceMode = mode;
  _numPerformanceModeRequests = 1;
}

return PerformanceModeRequestHandle._(_disposePerformanceModeRequest);

}
/// Remove a request for a specific [DartPerformanceMode].
///
/// If all the pending requests have been disposed, the engine will revert to the
/// [DartPerformanceMode.balanced] performance mode.
void _disposePerformanceModeRequest() {
_numPerformanceModeRequests--;
if (_numPerformanceModeRequests == 0) {
_performanceMode = null;
PlatformDispatcher.instance.requestDartPerformanceMode(DartPerformanceMode.balanced);
}
}
/// Returns the current [DartPerformanceMode] requested or null if no requests have
/// been made.
///
/// This is only supported in debug and profile modes, returns null in release mode.
DartPerformanceMode? debugGetRequestedPerformanceMode() {
if (!(kDebugMode || kProfileMode)) {
return null;
} else {
return _performanceMode;
}
}
/// Called by the engine to produce a new frame.
///
/// This method is called immediately after [handleBeginFrame]. It calls all
/// the callbacks registered by [addPersistentFrameCallback], which typically
/// drive the rendering pipeline, and then calls the callbacks registered by
/// [addPostFrameCallback].
///
/// See [handleBeginFrame] for a discussion about debugging hooks that may be
/// useful when working with frame callbacks.
void handleDrawFrame() {
assert(_schedulerPhase == SchedulerPhase.midFrameMicrotasks);
_frameTimelineTask?.finish(); // end the "Animate" phase
try {
// PERSISTENT FRAME CALLBACKS
_schedulerPhase = SchedulerPhase.persistentCallbacks;
for (final FrameCallback callback in _persistentCallbacks) {
_invokeFrameCallback(callback, _currentFrameTimeStamp!);
}
  // POST-FRAME CALLBACKS
  _schedulerPhase = SchedulerPhase.postFrameCallbacks;
  final List<FrameCallback> localPostFrameCallbacks =
      List<FrameCallback>.of(_postFrameCallbacks);
  _postFrameCallbacks.clear();
  for (final FrameCallback callback in localPostFrameCallbacks) {
    _invokeFrameCallback(callback, _currentFrameTimeStamp!);
  }
} finally {
  _schedulerPhase = SchedulerPhase.idle;
  _frameTimelineTask?.finish(); // end the Frame
  assert(() {
    if (debugPrintEndFrameBanner) {
      debugPrint('▀' * _debugBanner!.length);
    }
    _debugBanner = null;
    return true;
  }());
  _currentFrameTimeStamp = null;
}

}
void _profileFramePostEvent(FrameTiming frameTiming) {
postEvent('Flutter.Frame', <String, dynamic>{
'number': frameTiming.frameNumber,
'startTime': frameTiming.timestampInMicroseconds(FramePhase.buildStart),
'elapsed': frameTiming.totalSpan.inMicroseconds,
'build': frameTiming.buildDuration.inMicroseconds,
'raster': frameTiming.rasterDuration.inMicroseconds,
'vsyncOverhead': frameTiming.vsyncOverhead.inMicroseconds,
});
}
static void _debugDescribeTimeStamp(Duration timeStamp, StringBuffer buffer) {
if (timeStamp.inDays > 0) {
buffer.write('${timeStamp.inDays}d ');
}
if (timeStamp.inHours > 0) {
buffer.write('${timeStamp.inHours - timeStamp.inDays * Duration.hoursPerDay}h ');
}
if (timeStamp.inMinutes > 0) {
buffer.write('${timeStamp.inMinutes - timeStamp.inHours * Duration.minutesPerHour}m ');
}
if (timeStamp.inSeconds > 0) {
buffer.write('${timeStamp.inSeconds - timeStamp.inMinutes * Duration.secondsPerMinute}s ');
}
buffer.write('${timeStamp.inMilliseconds - timeStamp.inSeconds * Duration.millisecondsPerSecond}');
final int microseconds = timeStamp.inMicroseconds - timeStamp.inMilliseconds * Duration.microsecondsPerMillisecond;
if (microseconds > 0) {
buffer.write('.${microseconds.toString().padLeft(3, "0")}');
}
buffer.write('ms');
}
// Calls the given [callback] with [timestamp] as argument.
//
// Wraps the callback in a try/catch and forwards any error to
// [debugSchedulerExceptionHandler], if set. If not set, prints
// the error.
@pragma('vm:notify-debugger-on-exception')
void _invokeFrameCallback(FrameCallback callback, Duration timeStamp, [ StackTrace? callbackStack ]) {
assert(_FrameCallbackEntry.debugCurrentCallbackStack == null);
assert(() {
_FrameCallbackEntry.debugCurrentCallbackStack = callbackStack;
return true;
}());
try {
callback(timeStamp);
} catch (exception, exceptionStack) {
FlutterError.reportError(FlutterErrorDetails(
exception: exception,
stack: exceptionStack,
library: 'scheduler library',
context: ErrorDescription('during a scheduler callback'),
informationCollector: (callbackStack == null) ? null : () {
return [
DiagnosticsStackTrace(
'\nThis exception was thrown in the context of a scheduler callback. '
'When the scheduler callback was registered (as opposed to when the '
'exception was thrown), this was the stack',
callbackStack,
),
];
},
));
}
assert(() {
_FrameCallbackEntry.debugCurrentCallbackStack = null;
return true;
}());
}
}
/// The default [SchedulingStrategy] for [SchedulerBinding.schedulingStrategy].
///
/// If there are any frame callbacks registered, only runs tasks with
/// a [Priority] of [Priority.animation] or higher. Otherwise, runs
/// all tasks.
bool defaultSchedulingStrategy({ required int priority, required SchedulerBinding scheduler }) {
if (scheduler.transientCallbackCount > 0) {
return priority >= Priority.animation.value;
}
return true;
}

Hi @HongWeiChen, thanks for the investigation.
Which line of code in the file causes the issue?
Also, is this issue limited to macOS 12.6.1 or it affects other versions of macOS as well?

I found that the problem comes from handleAppLifecycleStateChanged this method, the swich (state), in case AppLifecycleState. Hidden, _setFramesEnabledState(false) is displayed. That caused me to switch back from other apps
Execute the following code
void _setFramesEnabledState(bool enabled) {
if (_framesEnabled == enabled) {
return;
}
_framesEnabled = enabled;
if (enabled) {
scheduleFrame();
}
}
Will be in
if (_framesEnabled == enabled) {
return;
}
The return in this method leads to no re-rendering. As far as I know, I can't confirm the above specific reasons. This code makes me think that it is very much like a lock, as if the rendering method is locked

At present, I can confirm the affected Mac OS versions as follows:
12.6.1 13.4 12.5, I don't have any other Mac machines to test, but I think the impact should be widespread.
However, this problem only occurs when you switch to the Windows of other applications and return to the current subwindow of the application

I created a code repository to show this problem. You can download the sample and test this problem with flutter 3.13.0. I also included images showing how to open multiple Windows. Run flutter pub get first @danagbemava-nc

Hi @HongWeiChen, it seems like you forgot to share the repository here. Please share the link to the repository.
Thank you

@danagbemava-nc sorry!! this is repository link https://github.com/HongWeiChen/multi_window_bug_example

Hi @HongWeiChen, I ran the code sample but I didn't notice any strange behavior. Can you share a screen recording that captures the issue you're experiencing?
Thank you

You need to follow the instructions I mentioned to open a new window, you can find the new window opened after clicking on the new window screen, you can switch colors, but if you switch to other applications when switching to the new window just created, the new window will not react any more

Hi @HongWeiChen, this is what I see when I run the app and switch windows. It works just fine.
https://github.com/flutter/flutter/assets/88313112/cb35af8f-906b-4eec-9e4c-b8facad6982c
Can you try this on the latest version of flutter stable (3.13.2)? I tested on an M1 mac running macOS 13.4.1.

I can now reproduce the issue using the code sample shared in https://github.com/flutter/flutter/issues/133533#issuecomment-1704775840. It seems like it doesn't always reproduce which is why the first time I wasn't able to do so.
The plugin uses a third-party plugin (desktop_multi_window) but according to OP, there might be something in the framework that is causing this behavior. See https://github.com/flutter/flutter/issues/133533#issuecomment-1699126924, https://github.com/flutter/flutter/issues/133533#issuecomment-1702001929 & https://github.com/flutter/flutter/issues/133533#issuecomment-1700228736
I am unable to test this on other desktop platforms at the moment, so there's a possibility that macOS is not the only affected platform.
Labeling for further insight from the team.

video
https://github.com/flutter/flutter/assets/88313112/756bbeee-df49-49fd-88d5-69eb33266a53

flutter doctor -v
[!] Flutter (Channel stable, 3.13.2, on macOS 13.4.1 22F770820d darwin-arm64, locale en-GB)
    • Flutter version 3.13.2 on channel stable at /Users/nexus/dev/sdks/flutter
    ! Warning: `flutter` on your path resolves to /Users/nexus/dev/sdks/flutters/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutter. Consider adding /Users/nexus/dev/sdks/flutter/bin to the front of your path.
    ! Warning: `dart` on your path resolves to /Users/nexus/dev/sdks/flutters/bin/dart, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutter. Consider adding /Users/nexus/dev/sdks/flutter/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ff5b5b5fa6 (2 weeks ago), 2023-08-24 08:12:28 -0500
    • Engine revision b20183e040
    • Dart version 3.1.0
    • DevTools version 2.25.0
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-33, build-tools 33.0.1
    • Java binary at: /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/223.8836.35.2231.10406996/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode-14.3.0.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/223.8836.35.2231.10406996/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2.1)
    • IntelliJ at /Users/nexus/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 75.1.4
    • Dart plugin version 232.9559.10

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2)
    • IntelliJ at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/232.8660.185/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2.1)
    • IntelliJ at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/232.9559.62/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.81.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.72.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.4.1 22F770820d darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 116.0.5845.179

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

[✓] Flutter (Channel master, 3.14.0-14.0.pre.137, on macOS 13.4.1 22F770820d darwin-arm64, locale en-GB)
    • Flutter version 3.14.0-14.0.pre.137 on channel master at /Users/nexus/dev/sdks/flutters
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 83c24274bb (2 hours ago), 2023-09-07 01:20:06 -0400
    • Engine revision 187c5b3c5f
    • Dart version 3.2.0 (build 3.2.0-134.0.dev)
    • DevTools version 2.27.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-33, build-tools 33.0.1
    • Java binary at: /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/223.8836.35.2231.10406996/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode-14.3.0.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/223.8836.35.2231.10406996/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2)
    • IntelliJ at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/232.8660.185/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2.1)
    • IntelliJ at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/232.9559.62/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.81.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.72.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.4.1 22F770820d darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 116.0.5845.179

[✓] Network resources
    • All expected network resources are available.

• No issues found!

@danagbemava-nc I found that in Flutter 3.13.x, in addition to this issue, FlutterMacOS dynamic library seems to have some issues, but I am not sure if it is FlutterMacOS dynamic library issues, I use Flutter 3.13.x to build a pkg installation package, Then it would crash immediately after installation, but I didn't use the 3.13.x version to build the pkg installation package, so I didn't have any problems.

Translated Report (Full Report Below)
Process:               轻聊 [4438]
Path:                  /Applications/轻聊.app/Contents/MacOS/轻聊
Identifier:            aicheban.com.im
Version:               1.0.9 (10)
Code Type:             ARM-64 (Native)
Parent Process:        launchd [1]
User ID:               502
Date/Time:             2023-09-05 15:38:19.8944 +0800
OS Version:            macOS 12.5.1 (21G83)
Report Version:        12
Anonymous UUID:        1DF57D2B-711C-AED7-8242-0C34E900BE56
Sleep/Wake UUID:       CAB150C8-CACF-499C-9C8E-39B10D89A7DF
Time Awake Since Boot: 880 seconds
Time Since Wake:       132 seconds
System Integrity Protection: enabled
Crashed Thread:        0
Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY
Termination Reason:    Namespace DYLD, Code 1 Library missing
Library not loaded<EMAIL_ADDRESS>Referenced from: '/Applications/轻聊.app/Contents/MacOS/轻聊'
Reason: tried: '' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file), 'xm
(terminated at launch; ignore backtrace)
Thread 0 Crashed:
0   dyld                          	       0x104f2be98 __abort_with_payload + 8
1   dyld                          	       0x104f33024 abort_with_payload_wrapper_internal + 104
2   dyld                          	       0x104f33058 abort_with_payload + 16
3   dyld                          	       0x104eeaa28 dyld4::halt(char const*) + 580
4   dyld                          	       0x104ee5fb8 dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 3644
5   dyld                          	       0x104ee506c start + 488
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000006   x1: 0x0000000000000001   x2: 0x000000016d78e968   x3: 0x0000000000000079
x4: 0x000000016d78e568   x5: 0x0000000000000000   x6: 0x0000000000000000   x7: 0x0000000000000000
x8: 0x0000000000000020   x9: 0x0000000000000009  x10: 0x000000016d78e5c8  x11: 0x000000000000008e
x12: 0x0000000000000000  x13: 0x0000000000000034  x14: 0x00000000000fb070  x15: 0x0000000000000000
x16: 0x0000000000000209  x17: 0x0000000104ee314c  x18: 0x0000000000000000  x19: 0x0000000000000000
x20: 0x000000016d78e568  x21: 0x0000000000000079  x22: 0x000000016d78e968  x23: 0x0000000000000001
x24: 0x0000000000000006  x25: 0x000000016d78e568  x26: 0x0000000000000400  x27: 0x000000000000013a
x28: 0x00000000000003e9   fp: 0x000000016d78e530   lr: 0x0000000104f33024
sp: 0x000000016d78e4f0   pc: 0x0000000104f2be98 cpsr: 0x00001000
far: 0x00000001050f0000  esr: 0x56000080  Address size fault
Binary Images:
0x104ee0000 -        0x104f3ffff dyld (*) <75627683-a780-32ad-ae34-cf86dd23a26b> /usr/lib/dyld
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 34
thread_create: 0
thread_set_state: 0
VM Region Summary:
ReadOnly portion of Libraries: Total=39.2M resident=0K(0%) swapped_out_or_unallocated=39.2M(100%)
Writable regions: Total=16.5M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=16.5M(100%)
                            VIRTUAL   REGION

REGION TYPE                        SIZE    COUNT (non-coalesced)
===========                     =======  =======
STACK GUARD                       56.0M        1
Stack                             8176K        1
VM_ALLOCATE                         16K        1
__DATA                            8544K       28
__DATA_CONST                      1504K       26
__LINKEDIT                        11.8M       26
__TEXT                            27.4M       26
dyld private memory               1024K        1
===========                     =======  =======
TOTAL                            114.1M      110

Full Report
{"app_name":"轻聊","timestamp":"2023-09-05 15:38:20.00 +0800","app_version":"1.0.9","slice_uuid":"fc1e23de-24d2-3cc5-b976-e5a0f4386b87","build_version":"10","platform":1,"bundleID":"aicheban.com.im","share_with_app_devs":0,"is_first_party":0,"bug_type":"309","os_version":"macOS 12.5.1 (21G83)","incident_id":"EE2D1F18-74FA-4B3D-8A1D-5704601656B4","name":"轻聊"}
{
"uptime" : 880,
"procLaunch" : "2023-09-05 15:38:19.7991 +0800",
"procRole" : "Default",
"version" : 2,
"userID" : 502,
"deployVersion" : 210,
"modelCode" : "MacBookAir10,1",
"procStartAbsTime" :<PHONE_NUMBER>4,
"coalitionID" : 1793,
"osVersion" : {
"train" : "macOS 12.5.1",
"build" : "21G83",
"releaseType" : "User"
},
"captureTime" : "2023-09-05 15:38:19.8944 +0800",
"incident" : "EE2D1F18-74FA-4B3D-8A1D-5704601656B4",
"bug_type" : "309",
"pid" : 4438,
"procExitAbsTime" :<PHONE_NUMBER>9,
"translated" : false,
"cpuType" : "ARM-64",
"procName" : "轻聊",
"procPath" : "/Applications/轻聊.app/Contents/MacOS/轻聊",
"bundleInfo" : {"CFBundleShortVersionString":"1.0.9","CFBundleVersion":"10","CFBundleIdentifier":"aicheban.com.im"},
"storeInfo" : {"deviceIdentifierForVendor":"861C0568-FC6D-5E31-BC91-6B0057A9CF0C","thirdParty":true},
"parentProc" : "launchd",
"parentPid" : 1,
"coalitionName" : "aicheban.com.im",
"crashReporterKey" : "1DF57D2B-711C-AED7-8242-0C34E900BE56",
"wakeTime" : 132,
"sleepWakeUUID" : "CAB150C8-CACF-499C-9C8E-39B10D89A7DF",
"sip" : "enabled",
"isCorpse" : 1,
"exception" : {"codes":"0x0000000000000000, 0x0000000000000000","rawCodes":[0,0],"type":"EXC_CRASH","signal":"SIGABRT"},
"termination" : {"code":1,"flags":518,"namespace":"DYLD","indicator":"Library missing","details":["(terminated at launch; ignore backtrace)"],"reasons":["Library not loaded: '@rpath/FlutterMacOS.framework/Versions/A/FlutterMacOS'","Referenced from: '/Applications/轻聊.app/Contents/MacOS/轻聊'","Reason: tried: '' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file), 'xm\u0001"]},
"extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":34},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
"faultingThread" : 0,
"threads" : [{"triggered":true,"id":33602,"threadState":{"x":[{"value":6},{"value":1},{"value":6131607912},{"value":121},{"value":6131606888},{"value":0},{"value":0},{"value":0},{"value":32},{"value":9},{"value":6131606984},{"value":142},{"value":0},{"value":52},{"value":1028208},{"value":0},{"value":521},{"value":4377686348,"symbolLocation":392,"symbol":"__simple_bprintf"},{"value":0},{"value":0},{"value":6131606888},{"value":121},{"value":6131607912},{"value":1},{"value":6},{"value":6131606888},{"value":1024},{"value":314},{"value":1001}],"flavor":"ARM_THREAD_STATE64","lr":{"value":4378013732},"cpsr":{"value":4096},"fp":{"value":6131606832},"sp":{"value":6131606768},"esr":{"value":1442840704,"description":" Address size fault"},"pc":{"value":4377984664,"matchesCrashFrame":1},"far":{"value":4379836416}},"frames":[{"imageOffset":310936,"symbol":"__abort_with_payload","symbolLocation":8,"imageIndex":0},{"imageOffset":340004,"symbol":"abort_with_payload_wrapper_internal","symbolLocation":104,"imageIndex":0},{"imageOffset":340056,"symbol":"abort_with_payload","symbolLocation":16,"imageIndex":0},{"imageOffset":43560,"symbol":"dyld4::halt(char const*)","symbolLocation":580,"imageIndex":0},{"imageOffset":24504,"symbol":"dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*)","symbolLocation":3644,"imageIndex":0},{"imageOffset":20588,"symbol":"start","symbolLocation":488,"imageIndex":0}]}],
"usedImages" : [
{
"source" : "P",
"arch" : "arm64e",
"base" :<PHONE_NUMBER>,
"size" : 393216,
"uuid" : "75627683-a780-32ad-ae34-cf86dd23a26b",
"path" : "/usr/lib/dyld",
"name" : "dyld"
}
],
"sharedCache" : {
"base" :<PHONE_NUMBER>,
"size" :<PHONE_NUMBER>,
"uuid" : "f8ab76fb-504c-32dd-a5db-15a1f2f028f8"
},
"vmSummary" : "ReadOnly portion of Libraries: Total=39.2M resident=0K(0%) swapped_out_or_unallocated=39.2M(100%)\nWritable regions: Total=16.5M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=16.5M(100%)\n\n                                VIRTUAL   REGION \nREGION TYPE                        SIZE    COUNT (non-coalesced) \n===========                     =======  ======= \nSTACK GUARD                       56.0M        1 \nStack                             8176K        1 \nVM_ALLOCATE                         16K        1 \n__DATA                            8544K       28 \n__DATA_CONST                      1504K       26 \n__LINKEDIT                        11.8M       26 \n__TEXT                            27.4M       26 \ndyld private memory               1024K        1 \n===========                     =======  ======= \nTOTAL                            114.1M      110 \n",
"legacyInfo" : {
"threadTriggered" : {
}
},
"trialInfo" : {
"rollouts" : [
{
"rolloutId" : "6112e14f37f5d11121dcd519",
"factorPackIds" : {
"SIRI_TEXT_TO_SPEECH" : "634710168e8be655c1316aaa"
},
"deploymentId" : 240000229
},
{
"rolloutId" : "607844aa04477260f58a8077",
"factorPackIds" : {
"SIRI_MORPHUN_ASSETS" : "6103050cbfe6dc472e1c982a"
},
"deploymentId" : 240000066
}
],
"experiments" : [
{
"treatmentId" : "8ca8349c-e2bc-482c-9ca7-3907b48a5341",
"experimentId" : "648b5a581b04c12d4127bbb6",
"deploymentId" : 400000001
},
{
"treatmentId" : "6dd670af-0633-45e4-ae5f-122ae4df02be",
"experimentId" : "64406ba83deb637ac8a04419",
"deploymentId" : 900000017
}
]
}
}
Model: MacBookAir10,1, BootROM 7459.141.1, proc 8:4:4 processors, 16 GB, SMC
Graphics: Apple M1, Apple M1, Built-In
Display: DELL P3222QE, 5120 x 2880 (5K/UHD+ - Ultra High Definition Plus), Main, MirrorOff, Online
Memory Module: LPDDR4
AirPort: Wi-Fi, wl0: Mar 23 2022 19:57:59 version <IP_ADDRESS>.7.8.129 FWID 01-570be953
Bluetooth: Version (null), 0 services, 0 devices, 0 incoming serial ports
Network Service: USB 10/100/1000 LAN, Ethernet, en8
Network Service: Wi-Fi, AirPort, en0
USB Device: USB31Bus
USB Device: USB2806 Smart Hub
USB Device: Keychron C2
USB Device: Hub Feature Controller
USB Device: USB 10/100/1000 LAN
USB Device: USB31Bus
Thunderbolt Bus: MacBook Air, Apple Inc.
Thunderbolt Bus: MacBook Air, Apple Inc.

As this is not a common use case, and the upcoming multi-window support will solve this issue, marking as P3. (Track this project https://github.com/orgs/flutter/projects/39/views/1 ) (Desktop Triage)
If you have a PR that might fix this in the meantime (that has tests to avoid causing disruption), we'd be happy to review it.

Solved, can I join Google? (Joke)

Could you please check this issues, I need to add two windows to execute some operations.

Hello, I wanna give some update.
I recently tried on 3.19.4 and this issue seem to be fixed or doesn't exist.
However, I tried upgrading to 3.19.5 and 3.19.6 and the issue is there.

I downgraded to 3.19.3 and it works again???

A workaround, comment this line in your flutter project:
packages/flutter/lib/src/scheduler/binding.dart
_setFramesEnabledState(false);

Thanks @SebRincon it works!

The same is happening with my new plugin https://github.com/pichillilorenzo/window_manager_plus
I honestly didn't expect this behavior. On Windows seems to behave correctly.
As the official multi-window support is not coming soon as we seem to understand, fixing this could at least let us implement it in a way that could be usable, so please Flutter team take a look at it to fix it, thanks for the support!

I was able to create a workaround without changing the Flutter source code, using an AppLifecycleListener to force to trigger _setFramesEnabledState(true); instead of _setFramesEnabledState(false); using my window_manager_plus plugin.
In your app implement this listener this way inside your main widget extending a State:
class _MyAppState extends State<MyApp> {

  // your code ....

  late final AppLifecycleListener? _appLifecycleListener;

  @override
  void initState() {
    // your code ....
    // workaround applies for all sub-windows (all windows with id > 0) on macOS
    if (WindowManagerPlus.current.id > 0 && Platform.isMacOS) {
      _appLifecycleListener = AppLifecycleListener(
        onStateChange: _handleStateChange,
      );
    }
    super.initState();
  }

  void _handleStateChange(AppLifecycleState state) {
    // workaround applies for all sub-windows (all windows with id > 0) on macOS
    if (WindowManagerPlus.current.id > 0 && Platform.isMacOS && state == AppLifecycleState.hidden) {
      // trigger _setFramesEnabledState(true); method
      SchedulerBinding.instance.handleAppLifecycleStateChanged(
          AppLifecycleState.inactive);
    }
  }

  @override
  void dispose() {
    // your code ....
    _appLifecycleListener?.dispose();
    super.dispose();
  }

  // your code ....
}


Seems Broken

Tried any possible style to create a checkbox inside a table. Tried to create a table around it... nothing seems to work.

Table HTML Checkboxes Version: 1.0.1
Obsidian Version: 1.1.9

same issue, it's a shame, it'd be such a useful feature

I also can not get it to work

Same issue, can't get it to function

I managed to get it to work but eventually it gives say the following table:
| Time | Activity | Checkmark |
|------|----------|-----------|
| 05:30 | Wake up | <input type="checkbox" unchecked> |
| 05:30 - 06:00 | Morning routine | <input type="checkbox" unchecked> |
| 06:00 - 07:00 | Home workout | <input type="checkbox" unchecked> |
| 07:00 - 07:30 | Breakfast | <input type="checkbox" unchecked> |
| 07:30 - 12:30 | Work (5 hours) | <input type="checkbox" unchecked> |
| 12:30 - 13:00 | Lunch | <input type="checkbox" unchecked> |
| 13:00 - 18:00 | Work (5 hours) | <input type="checkbox" unchecked> |
| 18:00 - 18:30 | Dinner | <input type="checkbox" unchecked> |
| 18:30 - 22:30 | Work (4 hours) | <input type="checkbox" unchecked> |
| 22:30 - 05:30 | Sleep (7 hours) | <input type="checkbox" unchecked> |

But you cant even click the checkboxes, the only way to toggle them is by deleting the 'un' from the 'unchecked'.

this is not the plugin working but simply a feature of markdown

Hey @MaKaNu, @ArticExploit, @AdityaKrishnaProjects, @asparagusbeef, @BUTTOWSKIY & @thepancreator,
I've released a completely new version of the plugin - It should work near flawlessly now. Please give it a try and let me know if there's any issues.
Thanks.


Call datepicker from controller

I have an action-sheet and one of the options is to move the activity from one day to another and I want to trigger the date-picker from there.
Is it possible to trigger the date-picker from the controller?

As of now, that's not possible with this component. Using a directive is the suggested way to work with this plugin.


PKG_NO_TWO_FACTOR_AUTH

Hi, Google is forcing everybody to use 2FA, is there a way to make this CLI work in this new situation?
Error: PKG_NO_TWO_FACTOR_AUTH
Enabling 2 step verification on your account is required for security purposes. Please visit https://www.google.com/landing/2step to set it up.

How new is this? I've had 2FA enabled and this package has worked as late as last Wednesday (2022-01-05).

Same for me, I published an old extension as usual just yesterday. I think the error suggests that you enable 2FA, but then the API will continue again after you do. APIs are not affected by 2FA.

Yep, still works for me. https://github.com/AprilSylph/XKit-Rewritten/runs/4807835427?check_suite_focus=true
This is not an issue with the package.


Cannot compile when derived class has at least one #private field and constructor has statements before super()

TypeScript Version:  3.8.3

Search Terms:
super(), #private field, derived class, overload constructor
Code
export class A {
    constructor() {

    }
}

export class B extends A {
    #field: any;

    constructor() {
        1;
        super()
        this.#field = "any";
    }
}

Expected behavior:
should compile
Actual behavior:
compiler complains with
"A 'super' call must be the first statement in the constructor when a class contains initialized properties, parameter properties, or private identifiers.(2376)"
whereas if I use the "private" keyword instead of "#" it works perfectly fine
export class B extends A {
    private field: any;

    constructor() {
        1;
        super()
        this.field = "any"; // no complaints
    }
}

Playground Link:
http://www.typescriptlang.org/play/?ts=3.9.0-dev.20200311#
Related Issues:

class A { }
class B extends A {
    private a = 1;

    constructor() { // Error TS2376
        1;
        super();
        this.a = 0;
    }
}

Playground
class A { }
class B extends A {
    private a: any;

    constructor() { // There is no error, it is a bug
        1;
        super();
        this.a = 0;
    }
}

Playground
cc @RyanCavanaugh

class A { }
class B extends A {
    #a: any;
    constructor() { // error TS2376
        1;
        super();
        this.a = 0;
    }
}

class A { }
class B extends A {
    private a: any;
    constructor() { // there is no error
        1;
        super();
        this.a = 0;
    }
}

class A { }
class B extends A {
    private a = 1;
    constructor() { // error TS2376
        1;
        super();
        this.a = 0;
    }
}

@RyanCavanaugh Which example has the correct behavior?

// The first statement in the body of a constructor (excluding prologue directives) must be a super call
// if both of the following are true:
// - The containing class is a derived class.
// - The constructor declares parameter properties
//   or the containing class declares instance member variables with initializers.
const superCallShouldBeFirst =
    some((<ClassDeclaration>node.parent).members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) ||
    some(node.parameters, p => hasModifier(p, ModifierFlags.ParameterPropertyModifier));

It seems expected to avoid checking super in a constructor if a class member does not have initializer
class A { }
class B extends A {
    private a: any; // The class member without an initializer, so `superCallShouldBeFirst` is negative.
    constructor() {
        1;
        super();
        this.a = 0;
    }
}

class A { }
class B extends A {
    #a: any; // The class member is the PrivateIdentifier, so `superCallShouldBeFirst` is positive.
    constructor() {
        1;
        super();
        this.a = 0;
    }
}

cc @sandersn @RyanCavanaugh

This also applies to non-private class fields with useDefineForClassFields. As such this should work as well (as it already does in Chrome/Node):
class Bar {}

class Foo {
  #x = 12;
  y = 30;

  constructor() {
    console.log("Hello!");
    super();
  }
}

Given how limited superCallShouldBeFirst is, this error is still "correct", even for target: "esnext", useDefineForClassFields: true. Consider:
class Bar {}

class Foo {
  #x = 12;
  y = 30;
  constructor() {
    console.log(this.#x, this.y);
    super();
  }
}

Which is treated identically by the error, and does indeed error at runtime.
However, it may be the case that checkThisBeforeSuper is adequate and the superCallShouldBeFirst error is completely unneeded. I'm going to disable it and see how the baselines change.

I opened a PR to remove the superCallShouldBeFirst error entirely, but mainly so I could get the experts on class semantics to review it. I think we would have done this years ago if it were possible.


[Question] Why UpdateEntriesAsync doesn't go as a batch update?

As in the title. Why UpdateEntriesAsync doesn't go as a batch update with a changeset and so on?

Any updates on this?


slack connection fails while running the script locally

Founds the bot id correctly. But the rtm_connect statment returns false and can't connect to slack.

We have just fixed an issue that was causing failure.
I am now able to run the application locally without failure.
I'll close this. Please re-open if you still have an issue.

Hello, how did you do to solve this problem? I have the same problem now...


Default plugins broken (credentials-binding, jackson2-api, github)

After installing jenkins/jenkins:lts (=2.222.3), a lot of the default plugins cannot be installed because of failed dependencies:
2020-05-10 08:11:29.371+0000 [id=91]	SEVERE	h.model.UpdateCenter$DownloadJob#run: Failed to install credentials-binding
java.io.IOException: Downloaded file /var/jenkins_home/plugins/credentials-binding.jpi.tmp does not match expected SHA-256, expected '0tsPEoS2UEI3UUApcvSLUqkiisETySJxCNGeY9bXejo=', actual '7pCDZev0yZfcXd15LNWC1KDmGsPhF8rYuUIBKp+7sHY='
java.io.IOException: Downloaded file /var/jenkins_home/plugins/jackson2-api.jpi.tmp does not match expected SHA-256, expected 'MpjSdkuA3ZvAhDz5RLdyB+zN2qNRxdHgPa52kKqC45M=', actual 'G44spiRRttv5h0aH+6LZvub1+UlzREnIbg7OAUglwqM='
java.io.IOException: Downloaded file /var/jenkins_home/plugins/github.jpi.tmp does not match expected SHA-256, expected 'BZj7VvRWjVOSovmAQBaPdhs7B3XY0XK73o5VZoNK7Eo=', actual 'XYoPrsxXINvXn7hdzrr+8oGnAx69LC1gShXb4QKpFmM='
I've no idea how to fix this, so basically jenkins/jenkins:lts is currently broken.

This morning (BST) I have been seeing lots of 404s when using install-plugins.sh script to install plugins.
It now looks like the latest directory has been added to 2.222 folder https://updates.jenkins.io/2.222/
latest/ | 2020-05-10 09:01 | - |
However now with the latest and lts tags I get lots of corruption issues
error [/usr/share/jenkins/ref/plugins/artifactory.jpi]:  missing<PHONE_NUMBER> bytes in zipfile
  (attempting to process anyway)
error [/usr/share/jenkins/ref/plugins/artifactory.jpi]:  start of central directory not found;
  zipfile corrupt.
  (please check that you have transferred or created the zipfile in the
  appropriate BINARY mode and that you have compiled UnZip properly)

Sorry about the corrupt files, was an issue in the update site generator. Should be fixed now.

I have just run another build and am getting the same
e.g.
Downloading plugin: ec2 from https://updates.jenkins.io/download/plugins/ec2/latest/ec2.hpi
Downloaded file is not a valid ZIP: /usr/share/jenkins/ref/plugins/ec2.jpi
error [/usr/share/jenkins/ref/plugins/ec2.jpi]:  missing<PHONE_NUMBER> bytes in zipfile
  (attempting to process anyway)
error [/usr/share/jenkins/ref/plugins/ec2.jpi]:  start of central directory not found;
  zipfile corrupt.
  (please check that you have transferred or created the zipfile in the
  appropriate BINARY mode and that you have compiled UnZip properly)
Download integrity: ec2

Some plugins failed to download! Download integrity: blueocean
Download integrity: ec2
Download integrity: junit
Download integrity: artifactory
Download integrity: credentials-binding
Download integrity: echarts-api

I will give it an hour and see if it is a replication thing.
Thanks for the update though!

Sadly the log of this script doesn't tell you where it's redirected to for the download 😞

Sadly not. It's like a lottery of which plugins fail each time I run the script :D

Just for visibility, having still issues with the following plugins:

Some plugins failed to download! Download integrity: cloudbees-bitbucket-branch-source
--
790 | Download integrity: ec2
791 | Download integrity: blueocean-config
792 | Download integrity: matrix-auth
793 | Download integrity: blueocean-events
794 | Download integrity: blueocean-jwt
795 | Download integrity: blueocean-jira
796 | Download integrity: blueocean-pipeline-api-impl
797 | Download integrity: blueocean-pipeline-editor
798 | Download integrity: blueocean-rest
799 | Download integrity: blueocean-web
800 | Download integrity: jenkins-design-language
801 | Download integrity: blueocean-pipeline-scm-api

Out of our mirrors, there's still one, serverion, that hasn't updated since Saturday evening UTC 😦 22 hrs old and counting…

Has this issue been resolved with the mirrors updating?

Yes, was fixed on the Monday.

Seems this issue may have resurfaced with the latest update today.
15:46:44 Failed in the last attempt (curl -sSfL --connect-timeout 20 --retry 3 --retry-delay 0 --retry-max-time 60 https://updates.jenkins.io/2.235/latest/credentials-plugin.hpi -o /usr/share/jenkins/ref/plugins/credentials-plugin.jpi)
Failed to download plugin: credentials or credentials-plugin
15:46:44 Failed in the last attempt (curl -sSfL --connect-timeout 20 --retry 3 --retry-delay 0 --retry-max-time 60 https://updates.jenkins.io/2.235/latest/jackson2-api-plugin.hpi -o /usr/share/jenkins/ref/plugins/jackson2-api-plugin.jpi)

https://issues.jenkins-ci.org/browse/INFRA-2666

Looks like a duplicate of https://issues.jenkins-ci.org/browse/INFRA-160, again. This is a persistent issue due to how we distribute things.


Provide instructions on how to build docs

Add a section in the README on how to build the documentation -- via:
cd docs
make html

Done in f58826fe67acaa5818af1854857f0fc39cdbbe45


rust-utp stability

I'm creating the issue here because our rust-utp's fork still has the temp status (e.g. links on README.md point to upstream project, no CI configuration, no issues tab...), but this is an error on the rust-utp package (i.e. not crust).
Anyway, temp_utp crate is much more stable with version 0.7.1. Even more stable than the upstream project. And has more features (some of them change API). It's NOT advisable to use the upstream package. However, there are a few spots where we can still improve rust-utp stability.
If I run our fork's tests three times, I'll see a failure on the third time: https://gist.github.com/vinipsmaker/8780655649b77fe4a60e
Failing test is socket::test::test_network_with_timeout. This test executes the same test 100 times. So, if I had to run cargo three times to see this error, the failure rate could be 1 error in 300 runs. And it's not a unit test, so it's harder to debug and check what the error is. Also, the fact that the error will only happens a few times already gives a clue on how hard it is to debug it.
Also, I didn't need to use netem to reproduce the issues. I used GNU/Linux to reproduce this error.
Currently the most recent commit on temp_utp (the one I used to see the errors) is commit c6ad06ff81fc0fab8a3e7abf24f2ef4683f25cbf. This information is very useful if you want to check which lines are causing issue and stumble upon on this issue several weeks after it was filled.
Peter mentioned about this issue before (but not any detail from what I remember).

Just leaving a note to myself for further reference (something I just though about and I should check later when I have time):
I remember there were some messages of "close this connection right way" if an unexpected packet was received. This makes impossible for using several connections multiplexed connections in the same UDP port. We don't use and don't need multiplexed connections, but maybe the issue is related because we shouldn't force closing the connection as it might be a node from the previous/next run interacting with us (randomly they got the same port/connection-id). Need to check that later.

Given we won't use upstream package anymore (will be disabled for now and unusable when we move to async abstractions)... I'm closing this issue.


Appstudio update test-component-pac-nioj

Pipelines as Code configuration proposal
To start the PipelineRun, add a new comment with content /ok-to-test
For more detailed information about running a PipelineRun, please refer to Pipelines as Code documentation Running the PipelineRun
To customize the proposed PipelineRuns after merge, please refer to Build Pipeline customization

Pipelines as Code CI/test-component-pac-nioj-on-pull-request has successfully validated your commit.

StatusDurationName

✅ Succeeded
6 seconds
init

✅ Succeeded
20 seconds
clone-repository

✅ Succeeded
1 minute
build-container

✅ Succeeded
24 seconds
deprecated-base-image-check

✅ Succeeded
24 seconds
inspect-image

✅ Succeeded
23 seconds
clair-scan

✅ Succeeded
33 seconds
clamav-scan

✅ Succeeded
20 seconds
sbom-json-check

✅ Succeeded
8 seconds
label-check

✅ Succeeded
5 seconds
show-sbom

✅ Succeeded
6 seconds
show-summary

Pipelines as Code CI/test-component-pac-nioj-on-pull-request has successfully validated your commit.

StatusDurationName

✅ Succeeded
6 seconds
init

✅ Succeeded
20 seconds
clone-repository

✅ Succeeded
1 minute
build-container

✅ Succeeded
24 seconds
inspect-image

✅ Succeeded
24 seconds
deprecated-base-image-check

✅ Succeeded
33 seconds
clamav-scan

✅ Succeeded
23 seconds
clair-scan

✅ Succeeded
20 seconds
sbom-json-check

✅ Succeeded
8 seconds
label-check

✅ Succeeded
5 seconds
show-sbom

✅ Succeeded
6 seconds
show-summary

Pipelines as Code CI/test-component-pac-nioj-on-pull-request has successfully validated your commit.

StatusDurationName

✅ Succeeded
6 seconds
init

✅ Succeeded
13 seconds
clone-repository

✅ Succeeded
30 seconds
build-container

✅ Succeeded
15 seconds
deprecated-base-image-check

✅ Succeeded
16 seconds
inspect-image

✅ Succeeded
8 seconds
clair-scan

✅ Succeeded
34 seconds
clamav-scan

✅ Succeeded
9 seconds
sbom-json-check

✅ Succeeded
7 seconds
label-check

✅ Succeeded
7 seconds
show-summary

✅ Succeeded
4 seconds
show-sbom

Pipelines as Code CI/test-component-pac-nioj-on-pull-request has successfully validated your commit.

StatusDurationName

✅ Succeeded
6 seconds
init

✅ Succeeded
13 seconds
clone-repository

✅ Succeeded
30 seconds
build-container

✅ Succeeded
15 seconds
deprecated-base-image-check

✅ Succeeded
16 seconds
inspect-image

✅ Succeeded
8 seconds
clair-scan

✅ Succeeded
34 seconds
clamav-scan

✅ Succeeded
9 seconds
sbom-json-check

✅ Succeeded
7 seconds
label-check

✅ Succeeded
7 seconds
show-summary

✅ Succeeded
4 seconds
show-sbom


[Nox.Generators] Add IEntityHaveDomainEvents to Entities that support Domain Default Events

Create the interface contract IEntityHaveDomainEvents that has a property with the List of Events to raise and a method to add an event
public interface  { IEnumerable<IDomainEvent> DomainEvents {get;} void AddDomainEvent(IDomainEvent event); }

Update Create/Update/Partial/Delete/Also for Owned Entities (Raise the Update? ) template so the event is added after the OnCompleted Method is called
public async Task Handle(CreateCountryCommand request, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
OnExecuting(request);
var entityToCreate = _entityFactory.CreateEntity(request.EntityDto);
OnCompleted(request, entityToCreate);
entityToCreate.AddDomainEvent(new CountryCreated(entityToCreate))
_dbContext.Countries.Add(entityToCreate);
await _dbContext.SaveChangesAsync();
return new CountryKeyDto(entityToCreate.Id.Value);
}
related to #755 and depends on #760

https://regusit.atlassian.net/browse/MP-9230


Add a new metric ReadWriteBytesPerSecond for the storage sampler

ReadWriteBytesPerSecond as a sum of ReadBytesPerSec and WriteBytesPerSec metrics
Description of the changes
Add a detailed description and purpose of your changes.
Link the issue it solves (if there is one).
PR Review Checklist
Author

[x] the PR should focus on a single subject. Change only relevant files to the problem you’re working on
[x] clean and format the code
[x] add unit tests for your changes and make sure all unit tests are passing
[x] add a risk label after carefully considering the "blast radius" of your changes
[x] describe the intent of your changes in the description. don't just rewrite your code in prose
[x] assign at least one reviewer
[ ] address the feedback
[x] add a "ready for review" label. Only PRs with this label will be reviewed.

Reviewer

[ ] review code for readability
[ ] verify that high risk behavior changes are well tested
[ ] check license for any new external dependency
[ ] ask questions about anything that isn't clear and obvious
[ ] approve the PR when you consider it's good to merge

Rebased on master


Error in docker-compose how to resolve?

in "docker-compose up -d" this error occurs:
ERROR: for tendermint  Cannot start service tendermint: OCI runtime create failed: invalid mount {Destination:[ Type:bind Source:/var/lib/docker/volumes/dc480f76c79cb178eef04ab77ae262b1961d03ab5e4217f264063f5b47fcd563/_data Options:[rbind]}: mount destination [ not absolute: unknown ERROR: Encountered errors while bringing up the project.
How to solve, does anyone know?

Did you ever figure out what went wrong? I am running into a similar issue :(

Updating docker fixed my issues!
Also remember on windows you need to clone bigchain with unix line endings or you may get a "exec user process caused. No file or directory"
Add --config core.autocrlf=input to your git clone command to preserve/use unix line endings


Apply additional AssertJ best practices since #673

Issue

Follows https://github.com/langchain4j/langchain4j/pull/673

Change
Apply best practices once more, as time had passed between when #673 was opened and today. By clearing out any recipe suggestions on the main branch we ensure any new suggestions on PRs are limited to changed files.
General checklist

[x] There are no breaking changes
[x] I have added unit and integration tests for my change
[ ] I have manually run all the unit and integration tests in the module I have added/changed, and they are all green
[ ] I have manually run all the unit and integration tests in the core and main modules, and they are all green

[ ] I have added/updated the documentation

I see failures here that I also see on another PR:

https://github.com/langchain4j/langchain4j/pull/1833

[INFO] Running dev.langchain4j.model.openai.OpenAiLanguageModelIT
Error:  Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.087 s <<< FAILURE! -- in dev.langchain4j.model.openai.OpenAiLanguageModelIT
Error:  dev.langchain4j.model.openai.OpenAiLanguageModelIT.should_use_enum_as_model_name -- Time elapsed: 0.014 s <<< ERROR!
java.lang.IllegalArgumentException: baseUrl cannot be null or empty
	at dev.ai4j.openai4j.OpenAiClient$Builder.baseUrl(OpenAiClient.java:178)
	at dev.langchain4j.model.openai.OpenAiLanguageModel.<init>(OpenAiLanguageModel.java:55)
	at dev.langchain4j.model.openai.OpenAiLanguageModel$OpenAiLanguageModelBuilder.build(OpenAiLanguageModel.java:38)
	at dev.langchain4j.model.openai.OpenAiLanguageModelIT.<init>(OpenAiLanguageModelIT.java:20)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at java.base/java.util.Optional.orElseGet(Optional.java:369)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)

Not sure if that's something I can resolve, but it seems unrelated to the changes here.

Can't see the details of the Snyk test failures; let me know if anything there is actionable.

@timtebeek , could you please sync your branch with the base branch?


Fixed ActiveRecordTest test

Fixed ActiveRecordTest test

Why are you removing postgres support from travis?

Because we just need to test mysql here.

Changed travis.yml

Thank you!


Update README?

The README is the same as https://github.com/kbajalc/parquets, I think it could be updated:

the introduction tells its a parquet.js fork, but this is a parquets fork which is itself the parquet.js fork
the npm install and import instructions tell to use parquets but it should be @dvirtz/parquets

Do you think we should update it? If yes, do I miss anything which can be added?

sorry for missing this ticket until now. please tell me if there's still anything missing now.


Add "My Profile" section to update user's information.

See details here: https://github.com/stanfordnmbl/opencap-viewer-private/issues/207
Note: I like that @AlbertoCasasOrtiz

Idea: Show public sessions in the profile.