Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aqueduct db generate error: Bad state: NoSuchMethodError: The getter 'length' was called on null

On the system: Dart VM version: 2.9.0-14.0.dev.flutter-2b917f5b6a (be) (Wed Jun 10 15:46:47 2020 +0000) on "windows_x64"

It is OK when run "aqueduct db generate" to create 00000001_initial.migration.dart But, after edit models and rerun "aqueduct db generate", I get the message as below. After delete 00000001_initial.migration.dart and rerun, it is OK.

The message:

-- Aqueduct CLI Version: 3.3.0+1 -- Aqueduct project version: 3.2.0 *** Uncaught error Bad state: NoSuchMethodError: The getter 'length' was called on null. Receiver: null Tried calling: length **** Stacktrace

  • #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
  • #1 _ClassMirror.newInstance (dart:mirrors-patch/mirrors_impl.dart:653:44)
  • #2 Executable.instanceOf (data:application/dart:14:813)
  • #3 SchemaBuilderExecutable.execute (data:application/dart:13:873)
  • #4 main (data:application/dart:9:35)
  • #5 _startIsolate. (dart:isolate-patch/isolate_patch.dart:297:32)
  • #6 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

Please help me!

like image 439
Tony Avatar asked Jun 27 '20 09:06

Tony


2 Answers

It's a bug and it's still there. Happens when there is a previous migration file.

Just erase migrations/00000001_initial.migration.dart and then aqueduct db generate will work as expected.

Tested on Aqueduct 4.0.0-b1

p.s. I know it's the same solution given in the question but I was having the same problem and the solution wasn't clear at first.

like image 193
J. Pelaez Avatar answered Sep 21 '22 08:09

J. Pelaez


They actually fixed it

It's just not on pub.dev yet.

like image 30
lukas83 Avatar answered Sep 21 '22 08:09

lukas83