Skip to content

null check operator used on a null value flutter #269

Open

Description

@wincLei

macOs 14.2.1 (23C71) | 2.6 GHz 六核Intel Core i7 | 16 GB 2667 MHz DDR4

use New version available: 1.9.1
flutter sdk 3.24.0

pubspec.yaml config

environment:
sdk: '>=3.2.0 <4.0.0'

dependencies:
cupertino_icons: ^1.0.2
get: 4.6.6
flutter_screenutil: ^5.9.1
shared_preferences: ^2.2.2
cached_network_image: ^3.3.1
flutter_svg: ^2.0.10+1
intl: ^0.19.0
dio: ^5.4.3+1
flutter_tts: ^4.0.2
flutter_al: ^0.2.0
json_annotation: ^4.9.0
flutter:
sdk: flutter

dev_dependencies:
flutter_lints: ^2.0.0
flutter_test:
sdk: flutter

flutter:
uses-material-design: true

assets:
- assets/
- assets/images/
- assets/images/login/
- assets/sounds/object/

run get generate model on home with lib/app/modules/user/json/user.json

throw exception
null check operator used on a null value flutter

when i use flutter sdk 3.16.0 and get_cli 1.8.4 is ok

Activity

  1. uni-do-to commented on Aug 22, 2024

    @uni-do-to

    Same issue

  2. sanjay-rb commented on Aug 24, 2024

    @sanjay-rb

    I am also facing same issue

    `
    get generate model with /Users/sanjayrb/projects/mtracker/json/account.json

    Unhandled exception:
    Null check operator used on a null value
    #0 PubspecUtils.nullSafeSupport (package:get_cli/common/utils/pubspec/pubspec_utils.dart:146:76)
    #1 new TypeDefinition (package:get_cli/common/utils/json_serialize/sintaxe.dart:81:22)
    #2 new TypeDefinition.fromDynamic (package:get_cli/common/utils/json_serialize/sintaxe.dart:68:12)
    #3 ModelGenerator._generateClassDefinition (package:get_cli/common/utils/json_serialize/model_generator.dart:68:36)
    #4 ModelGenerator._generateClassDefinition (package:get_cli/common/utils/json_serialize/model_generator.dart:54:7)
    #5 ModelGenerator.generateUnsafeDart (package:get_cli/common/utils/json_serialize/model_generator.dart:148:9)
    #6 ModelGenerator.generateDartClasses (package:get_cli/common/utils/json_serialize/model_generator.dart:181:28)
    #7 GenerateModelCommand.execute (package:get_cli/commands/impl/generate/model/model.dart:41:35)
    <asynchronous suspension>
    #8 main. (file:///Users/sanjayrb/.pub-cache/hosted/pub.dev/get_cli-1.9.1/bin/get.dart:18:38)
    <asynchronous suspension>
    #9 main (file:///Users/sanjayrb/.pub-cache/hosted/pub.dev/get_cli-1.9.1/bin/get.dart:18:9)
    <asynchronous suspension>
    `

  3. bigbott commented on Aug 28, 2024

    @bigbott

    Same here.

  4. kingyyy commented on Aug 29, 2024

    @kingyyy

    Same here.

  5. locooo commented on Aug 30, 2024

    @locooo

    Unhandled exception:
    Null check operator used on a null value
    #0 PubspecUtils.nullSafeSupport (package:get_cli/common/utils/pubspec/pubspec_utils.dart:146:76)
    #1 new TypeDefinition (package:get_cli/common/utils/json_serialize/sintaxe.dart:81:22)
    #2 new TypeDefinition.fromDynamic (package:get_cli/common/utils/json_serialize/sintaxe.dart:68:12)
    #3 ModelGenerator._generateClassDefinition (package:get_cli/common/utils/json_serialize/model_generator.dart:68:36)
    #4 ModelGenerator.generateUnsafeDart (package:get_cli/common/utils/json_serialize/model_generator.dart:148:9)
    #5 ModelGenerator.generateDartClasses (package:get_cli/common/utils/json_serialize/model_generator.dart:181:28)
    #6 GenerateModelCommand.execute (package:get_cli/commands/impl/generate/model/model.dart:41:35)

    #7 main. (file:///Users/locoo/.pub-cache/hosted/pub.dev/get_cli-1.9.1/bin/get.dart:18:38)

    #8 main (file:///Users/locoo/.pub-cache/hosted/pub.dev/get_cli-1.9.1/bin/get.dart:18:9)

  6. irayshi commented on Sep 9, 2024

    @irayshi

    I also had the same problem, so for now I downgraded the version to 1.8.1 because I don't know why I can't install version 1.8.4.

  7. knottx commented on Oct 9, 2024

    @knottx
    Contributor

    See this #283

  8. whitecodel commented on Nov 12, 2024

    @whitecodel

    You can try this CLI tools for generating models

    https://github.com/whitecodel/jsontodart

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions