angulardart / angular_components

The official Material Design components for AngularDart. Used at Google in production apps.

Home Page:https://pub.dev/packages/angular_components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Material menu usage cause `Expected a value of type 'Null', but got one of type 'bool'`

muzuro opened this issue · comments

Couple days ago I started to recieve this error when user clicks on material-menu button. Menu is shown but it doesn't contains any text. In browser console I see stacktrace:

EXCEPTION: Expected a value of type 'Null', but got one of type 'bool'
STACKTRACE: 
dart:sdk_internal 115077:17                                                                                check_Null
package:quiver/src%5Ccore%5Coptional.dart 75:10                                                            or
package:angular_components/material_menu/menu_item_groups.dart 441:54                                      hasAutoFocus
package:angular_components/material_menu/menu_item_groups.template.dart 692:28                             detectChangesInternal
package:angular/src/bootstrap/..%5Ccore%5Clinker%5Capp_view.dart 404:7                                     detectCrash
package:angular/src/bootstrap/..%5Ccore%5Clinker%5Capp_view.dart 381:7                                     detectChanges
package:angular/src/bootstrap/..%5Ccore%5Clinker%5Cview_container.dart 67:15                               detectChangesInNestedViews
package:angular_components/material_menu/menu_item_groups.template.dart 499:14                             detectChangesInternal

It looks strange, because I haven't updated any piece of code related to this part of app.
I have tried to update angular dependencies to latest version - but error still reproduced, here is my pubspec.yaml content:

name: app_web
description: web app
homepage: https://site.com
author: Site Developers <dev@site.com>

environment:
  sdk: '>=2.2.2'

dependencies:
  angular: ^5.3.1
  angular_components: ^0.13.0+1
  observable: ^0.22.2
  angular_forms: ^2.1.2
  angular_router: ^2.0.0-alpha+16
  gtag_analytics: ^0.1.7+2
  app_facade:
      path: ../facade

dev_dependencies:
  build_runner: ^1.6.2
  build_web_compilers: ^2.0.0
  angular_test: ^2.3.0
  build_test: ^0.10.7
  test: ^1.6.2
  sass_builder: ^2.1.3
  sass: ^1.19.0

I have checked generated code at dart:sdk_internal 115077:17, here it is:

core.Null._check = function check_Null(o) {
    if (o == null) return o;
    return dart.as(o, core.Null, true);
  };

Can you give any tips what can cause this error?

Same here. I created a small sample project (the todo app using stagehand) to reproduce it (and test if messed up with my project or if I can reproduce it in another project).
menutest.zip
Unzip, pub get, webdev serve
Add a Todo then click on ... next to the trashbin
I use Dart 2.6.0.

Looks like it is quiver causing this issue. I have hardcoded quiver: 2.1.1 in my dependencies and it started to work.

Yes, that helped in my case too. Thank you. I tried it before but didn't mind the ^ - which makes the difference! So

dependencies:
  ...
  quiver: 2.1.1

seems to be a temporary work around for this issue.

With quiver: 2.1.1 dependency works for me too!

This issue should be resolved by google/quiver-dart#587 which will be released momentarily in v2.1.3. Sorry for the breakage and thanks for reporting!

2.1.3 is out the door. Please shout if this is still broken for you.