plus_plugins icon indicating copy to clipboard operation
plus_plugins copied to clipboard

[Bug]: type 'Null' is not a subtype of type 'String' in MacOS

Open gustavohenrique opened this issue 2 years ago • 1 comments

Platform

MacOS Sonoma 14.2

Plugin

device_info_plus

Version

9.1.1

Flutter SDK

3.16.5

Steps to reproduce

Just call macOsInfo function if (platform.isMacOS) { final info = await deviceInfo.macOsInfo; }

Code Sample

import 'package:platform/platform.dart';
import 'package:device_info_plus/device_info_plus.dart';
const LocalPlatform platform = LocalPlatform();
final deviceInfo = DeviceInfoPlugin();
if (platform.isMacOS) {
    final info = await deviceInfo.macOsInfo; MacOsDeviceInfo
    device.name = info.computerName;
    device.identifier = info.systemGUID ?? '';
    device.version = '${info.majorVersion}.${info.minorVersion}.${info.patchVersion}';
}

Logs

type 'Null' is not a subtype of type 'String'
package:device_info_plus/src/model/macos_device_info.dart 75:24  MacOsDeviceInfo.fromMap
package:device_info_plus/device_info_plus.dart 86:23             DeviceInfoPlugin.macOsInfo

Flutter Doctor

[✓] Flutter (Channel stable, 3.16.5, on macOS 14.2 23C64 darwin-x64, locale en-BR)
    • Flutter version 3.16.5 on channel stable at /Users/gustavo/apps/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 78666c8dc5 (11 days ago), 2023-12-19 16:14:14 -0800
    • Engine revision 3f3e560236
    • Dart version 3.2.3
    • DevTools version 2.28.4

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/gustavo/Android/Sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/gustavo/Android/Sdk
    • ANDROID_SDK_ROOT = /Users/gustavo/Android/Sdk
    • Java binary at: /Applications/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 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    • 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 /Applications/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)

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

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 14.2 23C64 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 120.0.6099.129

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

• No issues found!

Checklist before submitting a bug

  • [X] I searched issues in this repository and couldn't find such bug/problem
  • [X] I Google'd a solution and I couldn't find it
  • [X] I searched on StackOverflow for a solution and I couldn't find it
  • [X] I read the README.md file of the plugin
  • [X] I'm using the latest version of the plugin
  • [X] All dependencies are up to date with flutter pub upgrade
  • [X] I did a flutter clean
  • [X] I tried running the example project

gustavohenrique avatar Dec 30 '23 22:12 gustavohenrique

I tried with this code if (platform.isMacOS) { final info = await deviceInfo.macOsInfo; } but it doesn't give the respective exception you've mentioned. Are you getting this now? Anything else you want to add? @gustavohenrique

muhib349 avatar Jan 09 '24 01:01 muhib349

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days

github-actions[bot] avatar Apr 09 '24 00:04 github-actions[bot]