liquidart icon indicating copy to clipboard operation
liquidart copied to clipboard

Null check operator used on a null value using 'liquidart create my_app' command

Open cmalbuquerque opened this issue 3 years ago • 5 comments

I am trying to create a new liquidart application using the command liquidart create storage_app and the result is as follows:

Unhandled exception:
Null check operator used on a null value
#0      firstMetadataOfType (package:replica/src/mirror_context.dart:75:77)
#1      new MirrorContext._.<anonymous closure> (package:replica/src/mirror_context.dart:31:22)
#2      WhereIterator.moveNext (dart:_internal/iterable.dart:436:13)
#3      new _GrowableList._ofOther (dart:core-patch/growable_array.dart:198:26)
#4      new _GrowableList.of (dart:core-patch/growable_array.dart:152:26)
#5      new List.of (dart:core-patch/array_patch.dart:50:28)
#6      Iterable.toList (dart:core/iterable.dart:366:12)
#7      new MirrorContext._ (package:replica/src/mirror_context.dart:32:8)
#8      instance (package:replica/src/mirror_context.dart:7:41)
#9      instance (package:replica/src/mirror_context.dart)
#10     RuntimeContext.current (package:replica/src/context.dart:10:33)
#11     CLICommand.decode (package:liquidart/src/cli/command.dart:104:27)
#12     CLICommand.showColors (package:liquidart/src/cli/command.dart:64:26)
#13     CLICommand.colorSymbol (package:liquidart/src/cli/command.dart:219:10)
#14     CLICommand.displayError (package:liquidart/src/cli/command.dart:201:12)
#15     CLICommand.process (package:liquidart/src/cli/command.dart:168:7)
<asynchronous suspension>
#16     main (file:///Users/carolinaalbuquerque/.pub-cache/hosted/pub.dartlang.org/liquidart-5.0.0-b2/bin/liquidart.dart:9:14)
<asynchronous suspension>

Dart version: Dart SDK version: 2.12.2 (stable) (Wed Mar 17 10:30:20 2021 +0100) on "macos_x64"

pub global activate liquidart command was successful as you can see in the following output:

Resolving dependencies... (1.8s)
+ _fe_analyzer_shared 20.0.0
+ analyzer 1.4.0
+ args 2.0.0
+ async 2.5.0
+ buffer 1.1.1
+ charcode 1.2.0
+ checked_yaml 2.0.1
+ cli_util 0.3.0
+ collection 1.15.0
+ convert 3.0.0
+ crypto 3.0.1
+ dynacode 3.0.0-b1
+ file 6.1.0
+ glob 2.0.1
+ hasher 3.0.0-b1
+ json_annotation 4.0.1
+ liquidart 5.0.0-b2
+ logging 1.0.1
+ loner 3.0.0-b2
+ meta 1.3.0
+ open_api_data 3.0.0-b1
+ package_config 2.0.0
+ path 1.8.0
+ pedantic 1.11.0
+ postgres 2.3.2
+ pub_cache 0.3.0
+ pub_semver 2.0.0
+ pubspec_parse 1.0.0
+ replica 2.0.0-b2
+ safe_yaml 4.0.0-b1
+ source_span 1.8.1
+ string_scanner 1.1.0
+ term_glyph 1.2.0
+ typed_data 1.3.0
+ watcher 1.0.0
+ yaml 3.1.0
Downloading liquidart 5.0.0-b2...
Downloading yaml 3.1.0...
Downloading safe_yaml 4.0.0-b1...
Downloading pub_semver 2.0.0...
Downloading pub_cache 0.3.0...
Downloading postgres 2.3.2...
Downloading open_api_data 3.0.0-b1...
Downloading loner 3.0.0-b2...
Downloading hasher 3.0.0-b1...
Downloading dynacode 3.0.0-b1...
Downloading replica 2.0.0-b2...
Downloading pubspec_parse 1.0.0...
Downloading checked_yaml 2.0.1...
Downloading crypto 3.0.1...
Downloading analyzer 1.4.0...
Downloading package_config 2.0.0...
Downloading _fe_analyzer_shared 20.0.0...
Downloading buffer 1.1.1...
Precompiling executables... (9.6s)
Precompiled liquidart:liquidart.
Installed executable liquidart.
Activated liquidart 5.0.0-b2.

Any suggestion to fix this?

cmalbuquerque avatar Apr 20 '21 11:04 cmalbuquerque

@cmalbuquerque

I bumped into the same issue in the morning, and have been trying to fix this. This is not a problem with your application. This is an issue with the Liquidart package which was caused by the Null Safety migration.

I will try to fix this soon, and update you if anything comes up. Thanks for reporting the error. Please keep this issue open.

AldrinMathew avatar Apr 20 '21 11:04 AldrinMathew

I just found out that this issue pertains to the Dart language, and has been reported in the Dart project previously.

dm.metadata
      .firstWhere((im) => im!.reflectee is Operation, orElse: () => null)!
      .reflectee as Operation;

The orElse part of the code is what's causing the error. We have to replace that part with a conditional statement. There are more than 150 parts in the project where this pattern of code occurs. I have already started fixing it.

AldrinMathew avatar Apr 21 '21 04:04 AldrinMathew

@cmalbuquerque

Please read Issue 7: Liquidart will be rewritten from scratch to understand the status of this issue and the Liquidart project.

AldrinMathew avatar Apr 22 '21 17:04 AldrinMathew

@AldrinMathew any prediction for the release of your new Dart server framework? Also, good luck!

cmalbuquerque avatar Apr 22 '21 20:04 cmalbuquerque

@cmalbuquerque

I have already started working on it. As the liquidart package is getting more and more popular everyday on pub.dev, I hope I can release the initial version soon. I have already finished the abstraction for Server, Routes and UrlParameters. Although for the initial version, I will not be able to support Postgres, ORM, OAuth2. May be just Postgres. I will look into it.

AldrinMathew avatar Apr 23 '21 04:04 AldrinMathew