Skip to content

[MacOS] plugin not register in example multiple_windows #182450

Closed

Description

@MrWait

Steps to reproduce

It's a good news that flutter support native multiple windows on desktop.
I've tried multiple_windows in examples, based on new main channel(2026-02-05), it works good on macos.
After I add some third party plugins, such as shared_preferences(2.5.4) or device_info_plus(12.3.0),there are some error while invoking method:
[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel: "dev.flutter.pigeon.shared_preferences_foundation.LegacyUserDefaultsApi.getAll"., null, null)

I've checked 'macos/Flutter/GeneratedPluginRegistrant.swift', code was generated correctly:

import FlutterMacOS
import Foundation

import shared_preferences_foundation

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
  SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
}

It seems 'RegisterGeneratedPlugins' was not called, so plugin was not actual register.

Expected results

print device info correct.

Actual results

[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: MissingPluginException(No implementation found for method getDeviceInfo on channel dev.fluttercommunity.plus/device_info)

Code sample

Code sample
      final deviceInfoPlugin = DeviceInfoPlugin();
      final deviceInfo = await deviceInfoPlugin.deviceInfo;
      final allInfo = deviceInfo.data;
      print("get device info: ${allInfo}");

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel main, 3.42.0-1.0.pre-62, on macOS 15.4.1 24E263
    darwin-arm64, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version
    35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Connected device (2 available)
    ! Error: Browsing on the local area network for iPhonexs. Ensure the device
      is unlocked and attached with a cable or associated with the same local
      area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code
      -27)
[✓] Network resources

• No issues found!

Activity

  1. added
    in triage
    on Feb 16, 2026
  2. saurabh-mirajkar commented on Feb 16, 2026

    @saurabh-mirajkar
    Contributor

    Hi @MrWait, Thanks for the report.

    Kindly check #169977 (comment) for the solution.

    Closing as it is duplicate issue.

    Thank you.

  3. added
    r: duplicate
    and removed
    in triage
    on Feb 16, 2026
  4. removed
    r: duplicate
    on Feb 16, 2026
  5. stuartmorgan-g commented on Feb 16, 2026

    @stuartmorgan-g
    Contributor

    The steps here do not involve any dev dependencies, so it's not clear to me why this was marked as a duplicate. Re-opening for triage and investigation.

  6. MrWait commented on Feb 17, 2026

    @MrWait
    Author

    The steps here do not involve any dev dependencies, so it's not clear to me why this was marked as a duplicate. Re-opening for triage and investigation.

    Right.
    I pushed my code into this repo, please check:
    https://github.com/MrWait/DemoMultiWindow

    output:
    [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: MissingPluginException(No implementation found for method getDeviceInfo on channel dev.fluttercommunity.plus/device_info) #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:364:7) <asynchronous suspension> #1 MethodChannelDeviceInfo.deviceInfo (package:device_info_plus_platform_interface/method_channel/method_channel_device_info.dart:20:8) <asynchronous suspension> #2 DeviceInfoPlugin.macOsInfo (package:device_info_plus/device_info_plus.dart:91:10) <asynchronous suspension> #3 _MultiWindowAppState.initState.<anonymous closure> (package:multiple_windows/main.dart:53:26) <asynchronous suspension>

    Code in macos/Runner/AppDelegate.swift was different with other examples, which maybe root cause.

  7. added
    in triage
    on Feb 17, 2026
  8. saurabh-mirajkar commented on Feb 17, 2026

    @saurabh-mirajkar
    Contributor

    @MrWait Thanks for sharing the Github repository. I'm unable to run the cloned project, however below are the observations :

    Output of flutter run -d macos

    Launching lib/main.dart on macOS in debug mode...
    Adding Swift Package Manager integration...                         6.0s
    warning: Unable to read contents of XCFileList '/Target Support Files/Pods-Runner/Pods-Runner-frameworks-Debug-output-files.xcfilelist' (in target 'Runner' from project 'Runner')
    error: Unable to load contents of file list: '/Target Support Files/Pods-Runner/Pods-Runner-frameworks-Debug-input-files.xcfilelist' (in target 'Runner' from project 'Runner')
    error: Unable to load contents of file list: '/Target Support Files/Pods-Runner/Pods-Runner-frameworks-Debug-output-files.xcfilelist' (in target 'Runner' from project 'Runner')
    warning: Run script build phase '[CP] Embed Pods Frameworks' will be run during every build because it does not specify any outputs. To address this issue, 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 'Runner' from project 'Runner')
    ** BUILD FAILED **
    
    Building macOS application...                                           
    Error: Build process failed
    

    GeneratedPluginRegistrant.swift

    import FlutterMacOS
    import Foundation
    
    import device_info_plus
    import shared_preferences_foundation
    
    func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
      DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
      SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
    }
    

    Flutter Doctor Output

    Doctor summary (to see all details, run flutter doctor -v):
    [✓] Flutter (Channel main, 3.42.0-1.0.pre-148, on macOS 26.3 25D125 darwin-arm64, locale en-US)
    [✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0)
    [✓] Xcode - develop for iOS and macOS (Xcode 26.2)
    [✓] Chrome - develop for the web
    [✓] Connected device (3 available)
    [✓] Network resources
    
    • No issues found!
    

    Can you please try adding both device_info_plus & shared_preferences plugins under dev_dependencies instead of dependencies in my pubspec.yaml? Please check and confirm accordingly.

  9. added
    waiting for response
    on Feb 17, 2026
  10. MrWait commented on Feb 17, 2026

    @MrWait
    Author

    @MrWait Thanks for sharing the Github repository. I'm unable to run the cloned project, however below are the observations :

    Output of flutter run -d macos

    Launching lib/main.dart on macOS in debug mode...
    Adding Swift Package Manager integration...                         6.0s
    warning: Unable to read contents of XCFileList '/Target Support Files/Pods-Runner/Pods-Runner-frameworks-Debug-output-files.xcfilelist' (in target 'Runner' from project 'Runner')
    error: Unable to load contents of file list: '/Target Support Files/Pods-Runner/Pods-Runner-frameworks-Debug-input-files.xcfilelist' (in target 'Runner' from project 'Runner')
    error: Unable to load contents of file list: '/Target Support Files/Pods-Runner/Pods-Runner-frameworks-Debug-output-files.xcfilelist' (in target 'Runner' from project 'Runner')
    warning: Run script build phase '[CP] Embed Pods Frameworks' will be run during every build because it does not specify any outputs. To address this issue, 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 'Runner' from project 'Runner')
    ** BUILD FAILED **
    
    Building macOS application...                                           
    Error: Build process failed
    

    GeneratedPluginRegistrant.swift

    import FlutterMacOS
    import Foundation
    
    import device_info_plus
    import shared_preferences_foundation
    
    func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
      DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
      SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: `"SharedPreferencesPlugin"))`
    }
    

    Flutter Doctor Output

    Doctor summary (to see all details, run flutter doctor -v):
    [✓] Flutter (Channel main, 3.42.0-1.0.pre-148, on macOS 26.3 25D125 darwin-arm64, locale en-US)
    [✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0)
    [✓] Xcode - develop for iOS and macOS (Xcode 26.2)
    [✓] Chrome - develop for the web
    [✓] Connected device (3 available)
    [✓] Network resources
    
    • No issues found!
    

    Can you please try adding both device_info_plus & shared_preferences plugins under dev_dependencies instead of dependencies in my pubspec.yaml? Please check and confirm accordingly.

    Hi @saurabh-mirajkar, thanks for reply, seem you have some problem to run my code.
    There is another way for You to reproduce:

    1. copy flutter/examples/multiple_windows from official repo(main channel) to another directory.
    2. add device_info_plus(11.5.0) and shared_preferences(2.2.3) into pubspec.yaml, into dependencies.
    3. add code in main.dart: _MultiWindowAppState.initState:
        Future.delayed(Duration(seconds: 1), () async {
          final deviceInfoPlugin = DeviceInfoPlugin();
          final deviceInfo = await deviceInfoPlugin.deviceInfo;
          final allInfo = deviceInfo.data;
          print("get device info: ${allInfo}");
          SharedPreferences prefs = await SharedPreferences.getInstance();
          prefs.setString("key", "value");
        });
    
    
    1. don't forget import dependencies:
    import 'package:device_info_plus/device_info_plus.dart';
    import 'package:shared_preferences/shared_preferences.dart';
    

    That's what I did for all.

  11. removed
    waiting for response
    on Feb 17, 2026
  12. removed
    in triage
    on Feb 17, 2026
  13. 8 remaining items

  14. flutter-triage-bot commented on Aug 11, 2026

    @flutter-triage-bot

    This issue is assigned to @knopp but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!

  15. added
    ⏳
    on Aug 11, 2026
  16. removed
    triaged-macos
    on Oct 27, 2026
  17. flutter-triage-bot commented on Oct 27, 2026

    @flutter-triage-bot

    This issue was assigned to @knopp but has had no status updates in a long time. To remove any ambiguity about whether the issue is being worked on, the assignee was removed.

  18. removed
    ⏳
    on Oct 27, 2026
  19. added
    a: desktop
    has reproducible steps
    triaged-macos
    on Nov 5, 2026
  20. cbracken commented on Nov 5, 2026

    @cbracken
    Member

    /cc @knopp were you planning to pick this up?
    /cc @mattkae
    (triage)

  21. removed
    triaged-macos
    on Nov 5, 2026
  22. added
    triaged-macos
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2a: desktopa: multi windowa: pluginshas reproducible stepsplatform-macosteam-macostriaged-macos

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions