letsar / flutter_staggered_grid_view

A Flutter staggered grid view
MIT License
3.14k stars 510 forks source link

Null-aware warnings #311

Closed adil192 closed 1 year ago

adil192 commented 1 year ago

When I run flutter build web I get these warnings and a compilation error (but I don't know if that's related).

root@codespaces-d7690e:/workspaces/super_nonogram# flutter build web
Target dart2js failed: Exception: /root/.pub-cache/hosted/pub.dev/flutter_staggered_grid_view-0.6.2/lib/src/widgets/sliver_aligned_grid.dart:191:49:
Warning: Operand of null-aware operation '!' has type 'ScrollableState' which excludes null.
 - 'ScrollableState' is from 'package:flutter/src/widgets/scrollable.dart' ('../flutter/packages/flutter/lib/src/widgets/scrollable.dart').
    final axis = axisDirectionToAxis(Scrollable.of(context)!.axisDirection);
                                                ^
/root/.pub-cache/hosted/pub.dev/flutter_staggered_grid_view-0.6.2/lib/src/widgets/staggered_grid.dart:85:22:
Warning: Operand of null-aware operation '?.' has type 'ScrollableState' which excludes null.
 - 'ScrollableState' is from 'package:flutter/src/widgets/scrollable.dart' ('../flutter/packages/flutter/lib/src/widgets/scrollable.dart').
          Scrollable.of(context)?.axisDirection ??
                     ^
/root/.pub-cache/hosted/pub.dev/flutter_staggered_grid_view-0.6.2/lib/src/widgets/staggered_grid.dart:101:22:
Warning: Operand of null-aware operation '?.' has type 'ScrollableState' which excludes null.
 - 'ScrollableState' is from 'package:flutter/src/widgets/scrollable.dart' ('../flutter/packages/flutter/lib/src/widgets/scrollable.dart').
          Scrollable.of(context)?.axisDirection ??
                     ^

#0      Dart2JSTarget.build (package:flutter_tools/src/build_system/targets/web.dart:212:7)
<asynchronous suspension>
#1      _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:847:9)
<asynchronous suspension>
#2      Future.wait.<anonymous closure> (dart:async/future.dart:525:21)
<asynchronous suspension>
#3      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:785:32)
<asynchronous suspension>
#4      Future.wait.<anonymous closure> (dart:async/future.dart:525:21)
<asynchronous suspension>
#5      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:785:32)
<asynchronous suspension>
#6      FlutterBuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:614:16)
<asynchronous suspension>
#7      WebBuilder.buildWeb (package:flutter_tools/src/web/compile.dart:81:34)
<asynchronous suspension>
#8      BuildWebCommand.runCommand (package:flutter_tools/src/commands/build_web.dart:191:5)
<asynchronous suspension>
#9      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1336:27)
<asynchronous suspension>
#10     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#11     CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#12     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:296:9)
<asynchronous suspension>
#13     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#14     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:244:5)
<asynchronous suspension>
#15     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:91:9)
<asynchronous suspension>
#16     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#17     main (package:flutter_tools/executable.dart:91:3)
<asynchronous suspension>

Compiling lib/main.dart for the Web...                             24.5s
Exception: Failed to compile application for the Web.
root@codespaces-d7690e:/workspaces/super_nonogram# 
flutter doctor ``` Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.10.6, on Ubuntu 22.04.2 LTS 5.15.0-1042-azure, locale en_US.UTF-8) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) [✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome) ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable. [✗] Linux toolchain - develop for Linux desktop ✗ clang++ is required for Linux development. It is likely available from your distribution (e.g.: apt install clang), or can be downloaded from https://releases.llvm.org/ ✗ CMake is required for Linux development. It is likely available from your distribution (e.g.: apt install cmake), or can be downloaded from https://cmake.org/download/ ✗ ninja is required for Linux development. It is likely available from your distribution (e.g.: apt install ninja-build), or can be downloaded from https://github.com/ninja-build/ninja/releases ✗ pkg-config is required for Linux development. It is likely available from your distribution (e.g.: apt install pkg-config), or can be downloaded from https://www.freedesktop.org/wiki/Software/pkg-config/ [!] Android Studio (not installed) [✓] Connected device (1 available) [✓] Network resources ! Doctor found issues in 3 categories. ```