Skip to content

Target kernel_snapshot failed: Exception #126645

@arunabhdas

Description

@arunabhdas

Is there an existing issue for this?

Steps to reproduce

Create a flutter project with macos_main.dart that looks as below

Run the command

flutter run -t lib/macos_main.dart -d macos

Expected :
macOS window with menu appears

Environment -
macOS Apple Silicon (M2)

==> flutter --version
Flutter 3.10.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 84a1e904f4 (3 days ago) • 2023-05-09 07:41:44 -0700
Engine • revision d44b5a94c9
Tools • Dart 3.0.0 • DevTools 2.23.1

Expected results

macOS window appears with side menu

Actual results

Below error appears

==> flutter run -t lib/macos_main.dart -d macos
Launching lib/macos_main.dart on macOS in debug mode...
2023-05-12 04:07:24.687 xcodebuild[50086:21155412] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00006021-0018102436BB401E }
{ platform:macOS, arch:x86_64, id:00006021-0018102436BB401E }
../../../../../.pub-cache/hosted/pub.dev/macos_ui-1.12.2/lib/src/fields/text_field.dart:108:35: Error: The parameter 'details' of the method '_TextFieldSelectionGestureDetectorBuilder.onSingleTapUp' has type 'TapUpDetails', which does not match the corresponding type, 'TapDragUpDetails', in the overridden method, 'TextSelectionGestureDetectorBuilder.onSingleTapUp'.
 - 'TapUpDetails' is from 'package:flutter/src/gestures/tap.dart' ('../../../../../Developer/flutter/packages/flutter/lib/src/gestures/tap.dart').
 - 'TapDragUpDetails' is from 'package:flutter/src/widgets/tap_and_drag_gestures.dart' ('../../../../../Developer/flutter/packages/flutter/lib/src/widgets/tap_and_drag_gestures.dart').
Change to a supertype of 'TapDragUpDetails', or, for a covariant parameter, a subtype.
  void onSingleTapUp(TapUpDetails details) {
                                  ^
../../../../../Developer/flutter/packages/flutter/lib/src/widgets/text_selection.dart:2161:8: Context: This is the overridden method ('onSingleTapUp').
  void onSingleTapUp(TapDragUpDetails details) {
       ^
../../../../../.pub-cache/hosted/pub.dev/macos_ui-1.12.2/lib/src/fields/text_field.dart:130:42: Error: The parameter 'details' of the method '_TextFieldSelectionGestureDetectorBuilder.onDragSelectionEnd' has type 'DragEndDetails', which does not match the corresponding type, 'TapDragEndDetails', in the overridden method, 'TextSelectionGestureDetectorBuilder.onDragSelectionEnd'.
 - 'DragEndDetails' is from 'package:flutter/src/gestures/drag_details.dart' ('../../../../../Developer/flutter/packages/flutter/lib/src/gestures/drag_details.dart').
 - 'TapDragEndDetails' is from 'package:flutter/src/widgets/tap_and_drag_gestures.dart' ('../../../../../Developer/flutter/packages/flutter/lib/src/widgets/tap_and_drag_gestures.dart').
Change to a supertype of 'TapDragEndDetails', or, for a covariant parameter, a subtype.
  void onDragSelectionEnd(DragEndDetails details) {
                                         ^
../../../../../Developer/flutter/packages/flutter/lib/src/widgets/text_selection.dart:2839:8: Context: This is the overridden method ('onDragSelectionEnd').
  void onDragSelectionEnd(TapDragEndDetails details) {
       ^
Target kernel_snapshot failed: Exception

Command PhaseScriptExecution failed with a nonzero exit code
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Flutter Assemble' from project 'Runner')
** BUILD FAILED **

Code sample

Code sample
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:macos_ui/macos_ui.dart';



void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MacosApp(
      title: 'Unicorn AI',
      theme: MacosThemeData.light(), 
      darkTheme: MacosThemeData.dark(),
      themeMode: ThemeMode.system,
      home: const MyHomePage(title: 'Home'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int currentIndex = 0;

  @override
  Widget build(BuildContext context) {

    return MacosWindow(
      sidebar: Sidebar(
        builder: ((context, scrollController) {
          return SidebarItems(
            currentIndex: currentIndex, 
            onChanged: ((value) {
              setState(() {
                currentIndex = value;
              });
            }),
            items: const [
              SidebarItem(
                leading: MacosIcon(CupertinoIcons.home),
                selectedColor: Colors.greenAccent,
                label: Text('Home')
                ),
              SidebarItem(
                leading: MacosIcon(CupertinoIcons.gear),
                selectedColor: Colors.greenAccent,
                label: Text('Prompts')
                ),
              SidebarItem(
                leading: MacosIcon(CupertinoIcons.bookmark),
                selectedColor: Colors.greenAccent,
                label: Text('Analytics')
                ),
              SidebarItem(
                leading: MacosIcon(CupertinoIcons.layers),
                selectedColor: Colors.greenAccent,
                label: Text('About')
                ),
              ],
            );
        }),
        minWidth: 200,
        startWidth: 200,
        maxWidth: 350
      ),
      child: const Center(
        child: Text(
          'Hello, world!'),
        ),
    );
  }
}

pubspec.yaml contents

name: unicornapp
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1

environment:
  sdk: '>=3.0.0 <4.0.0'

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
  flutter:
    sdk: flutter


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  macos_ui: ^1.0.0
  hive: ^2.2.3
  hive_flutter: ^1.1.0

dev_dependencies:
  flutter_test:
    sdk: flutter

  # The "flutter_lints" package below contains a set of recommended lints to
  # encourage good coding practices. The lint set provided by the package is
  # activated in the `analysis_options.yaml` file located at the root of your
  # package. See that file for information about deactivating specific lint
  # rules and activating additional ones.
  flutter_lints: ^2.0.0
  hive_generator: ^2.0.0
  build_runner: ^2.4.2

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter packages.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  # assets:
  #   - images/a_dot_burr.jpeg
  #   - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
Launching lib/macos_main.dart on macOS in debug mode...
2023-05-12 04:07:24.687 xcodebuild[50086:21155412] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00006021-0018102436BB401E }
{ platform:macOS, arch:x86_64, id:00006021-0018102436BB401E }
../../../../../.pub-cache/hosted/pub.dev/macos_ui-1.12.2/lib/src/fields/text_field.dart:108:35: Error: The parameter 'details' of the method '_TextFieldSelectionGestureDetectorBuilder.onSingleTapUp' has type 'TapUpDetails', which does not match the corresponding type, 'TapDragUpDetails', in the overridden method, 'TextSelectionGestureDetectorBuilder.onSingleTapUp'.
 - 'TapUpDetails' is from 'package:flutter/src/gestures/tap.dart' ('../../../../../Developer/flutter/packages/flutter/lib/src/gestures/tap.dart').
 - 'TapDragUpDetails' is from 'package:flutter/src/widgets/tap_and_drag_gestures.dart' ('../../../../../Developer/flutter/packages/flutter/lib/src/widgets/tap_and_drag_gestures.dart').
Change to a supertype of 'TapDragUpDetails', or, for a covariant parameter, a subtype.
  void onSingleTapUp(TapUpDetails details) {
                                  ^
../../../../../Developer/flutter/packages/flutter/lib/src/widgets/text_selection.dart:2161:8: Context: This is the overridden method ('onSingleTapUp').
  void onSingleTapUp(TapDragUpDetails details) {
       ^
../../../../../.pub-cache/hosted/pub.dev/macos_ui-1.12.2/lib/src/fields/text_field.dart:130:42: Error: The parameter 'details' of the method '_TextFieldSelectionGestureDetectorBuilder.onDragSelectionEnd' has type 'DragEndDetails', which does not match the corresponding type, 'TapDragEndDetails', in the overridden method, 'TextSelectionGestureDetectorBuilder.onDragSelectionEnd'.
 - 'DragEndDetails' is from 'package:flutter/src/gestures/drag_details.dart' ('../../../../../Developer/flutter/packages/flutter/lib/src/gestures/drag_details.dart').
 - 'TapDragEndDetails' is from 'package:flutter/src/widgets/tap_and_drag_gestures.dart' ('../../../../../Developer/flutter/packages/flutter/lib/src/widgets/tap_and_drag_gestures.dart').
Change to a supertype of 'TapDragEndDetails', or, for a covariant parameter, a subtype.
  void onDragSelectionEnd(DragEndDetails details) {
                                         ^
../../../../../Developer/flutter/packages/flutter/lib/src/widgets/text_selection.dart:2839:8: Context: This is the overridden method ('onDragSelectionEnd').
  void onDragSelectionEnd(TapDragEndDetails details) {
       ^
Target kernel_snapshot failed: Exception

Command PhaseScriptExecution failed with a nonzero exit code
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Flutter Assemble' from project 'Runner')
** BUILD FAILED **

Building macOS application...                                           
Exception: Build process failed

Flutter Doctor output

Doctor output
==> flutter doctor -v
[✓] Flutter (Channel stable, 3.10.0, on macOS 13.2.1 22D68 darwin-arm64, locale en-US)
    • Flutter version 3.10.0 on channel stable at /Users/coder/Developer/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 84a1e904f4 (3 days ago), 2023-05-09 07:41:44 -0700
    • Engine revision d44b5a94c9
    • Dart version 3.0.0
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at /Users/coder/Library/Android/sdk
    • Platform android-33, build-tools 33.0.2
    • ANDROID_HOME = /Users/coder/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/coder/android-installer/adt-bundle-mac-x86_64-20130219/sdk
    • Java binary at: /Users/coder/Developer/AndroidStudio/AndroidStudio-2022_2_1_18-mac-arm/AndroidStudio-2022.2.1.18.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Users/coder/Developer/Xcode/Xcode_14_3_0/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
    • Android Studio at /Users/coder/Developer/AndroidStudio/AndroidStudio-2022_3_1-beta-1-mac-arm-giraffe/AndroidStudio-Giraffe-2022_3_1.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
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[!] Android Studio
    • Android Studio at /Users/coder/Developer/AndroidStudio/AndroidStudio-2023_1_1-canary-1-mac-arm-hedgehog/AndroidStudio-Hedgehog-2023_1_1.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
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[✓] Android Studio (version 2022.2)
    • Android Studio at /Users/coder/Developer/AndroidStudio/AndroidStudio-2022_2_1_18-mac-arm/AndroidStudio-2022.2.1.18.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.6b802.4-9586694)

[!] Android Studio
    • Android Studio at /Users/coder/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/223.8836.35.2231.9923731/Android Studio Preview.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
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[!] Android Studio
    • Android Studio at /Users/coder/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-1/223.8836.35.2311.9976484/Android Studio Preview.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
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

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

[✓] VS Code (version 1.79.0-insider)
    • VS Code at /Applications/Visual Studio Code - Insiders.app/Contents
    • Flutter extension version 3.65.20230510

[✓] Connected device (4 available)
    • AppiPhoneX4 (mobile) • 00008110-001E55660E8B801E • ios            • iOS 16.3.1 20D67
    • AppiPhoneX3 (mobile) • 00008030-000251620190402E • ios            • iOS 16.1 20B82
    • macOS (desktop)      • macos                     • darwin-arm64   • macOS 13.2.1 22D68 darwin-arm64
    • Chrome (web)         • chrome                    • web-javascript • Google Chrome 113.0.5672.92
    ! Error: App’s Apple Watch has not finished loading development services. Please select a different device, or wait for the device to load development services and try again. (code 8)

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

! Doctor found issues in 4 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: invalidIssue is closed as not valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions