DirectMyFile / console.dart

Console Library
Other
107 stars 24 forks source link

Errors regarding null-safety #31

Closed Quijx closed 3 years ago

Quijx commented 3 years ago

When I try to use the null-safe version 4.0.0 of this package I get a lot of errors (see below). Looking at the changes of #29 it seems to me that none of the actual null-safety migration has been done. #29 contains mainly changes from " to ' and some other refactorings, but for example none of the types that should be nullable have been marked nullable. Note that fixing these errors will likely not be enough. A proper null safety migration for example using the migration tool has to be done to ensure that all types that should be nullable are marked nullable and all types that should not be nullable are not marked nullable. My suggested course of action would be to revert 9d75fd4457831075c746c27bc3a2bbbc504ef4db and to a migration using the migration tool.

Here the errors:

../../../../../.pub-cache/hosted/pub.dartlang.org/console-4.0.0/lib/src/format.dart:111:3: Warning: Operand of null-aware operation '??=' has type 'VariableStyle' which excludes null.
 - 'VariableStyle' is from 'package:console/console.dart' ('../../../../../.pub-cache/hosted/pub.dartlang.org/console-4.0.0/lib/console.dart').
  style ??= VariableStyle.DEFAULT;
  ^
../../../../../.pub-cache/hosted/pub.dartlang.org/console-4.0.0/lib/src/color.dart:73:45: Warning: Operand of null-aware operation '??' has type 'StringBuffer' which excludes null.
 - 'StringBuffer' is from 'dart:core'.
  TextPen({StringBuffer buffer}) : buffer = buffer ?? StringBuffer();
                                            ^
Unable to spawn isolate: ../../../../../.pub-cache/hosted/pub.dartlang.org/console-4.0.0/lib/src/base.dart:12:16: Error: Field '_currentTextColor' should be initialized because its type 'Color' doesn't allow null.
 - 'Color' is from 'package:console/console.dart' ('../../../../../.pub-cache/hosted/pub.dartlang.org/console-4.0.0/lib/console.dart').
  static Color _currentTextColor;
               ^^^^^^^^^^^^^^^^^
../../../../../.pub-cache/hosted/pub.dartlang.org/console-4.0.0/lib/src/base.dart:13:16: Error: Field '_currentBackgroundColor' should be initialized because its type 'Color' doesn't allow null.
 - 'Color' is from 'package:console/console.dart' ('../../../../../.pub-cache/hosted/pub.dartlang.org/console-4.0.0/lib/console.dart').
  static Color _currentBackgroundColor;
               ^^^^^^^^^^^^^^^^^^^^^^^
../../../../../.pub-cache/hosted/pub.dartlang.org/console-4.0.0/lib/src/base.dart:135:31: Error: The parameter 'row' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
Try adding either an explicit non-'null' default value or the 'required' modifier.
  static void moveCursor({int row, int column}) {
                              ^^^
../../../../../.pub-cache/hosted/pub.dartlang.org/console-4.0.0/lib/src/base.dart:135:40: Error: The parameter 'column' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
Try adding either an explicit non-'null' default value or the 'required' modifier.
  static void moveCursor({int row, int column}) {
                                       ^^^^^^
../../../../../.pub-cache/hosted/pub.dartlang.org/console-4.0.0/lib/src/base.dart:177:38: Error: The parameter 'params' can't have a value of 'null' because of its type 'List<int>', but the implicit default value is 'null'.
 - 'List' is from 'dart:core'.
Try adding either an explicit non-'null' default value or the 'required' modifier.
  static void sgr(int id, [List<int> params]) {
                                     ^^^^^^
../../../../../.pub-cache/hosted/pub.dartlang.org/console-4.0.0/lib/src/format.dart:107:19: Error: The parameter 'args' can't have a value of 'null' because of its type 'List<String>', but the implicit default value is 'null'.
 - 'List' is from 'dart:core'.
Try adding either an explicit non-'null' default value or the 'required' modifier.
    {List<String> args,
                  ^^^^
../../../../../.pub-cache/hosted/pub.dartlang.org/console-4.0.0/lib/src/format.dart:108:25: Error: The parameter 'replace' can't have a value of 'null' because of its type 'Map<String, String>', but the implicit default value is 'null'.
 - 'Map' is from 'dart:core'.
Try adding either an explicit non-'null' default value or the 'required' modifier.
    Map<String, String> replace,
                        ^^^^^^^
../../../../../.pub-cache/hosted/pub.dartlang.org/console-4.0.0/lib/src/format.dart:109:19: Error: The parameter 'style' can't have a value of 'null' because of its type 'VariableStyle', but the implicit default value is 'null'.
 - 'VariableStyle' is from 'package:console/console.dart' ('../../../../../.pub-cache/hosted/pub.dartlang.org/console-4.0.0/lib/console.dart').
Try adding either an explicit non-'null' default value or the 'required' modifier.
    VariableStyle style,
                  ^^^^^
../../../../../.pub-cache/hosted/pub.dartlang.org/console-4.0.0/lib/src/format.dart:110:22: Error: The parameter 'resolver' can't have a value of 'null' because of its type 'String Function(String)', but the implicit default value is 'null'.
Try adding either an explicit non-'null' default value or the 'required' modifier.
    VariableResolver resolver}) {
                     ^^^^^^^^
../../../../../.pub-cache/hosted/pub.dartlang.org/console-4.0.0/lib/src/io.dart:3:41: Error: The parameter 'prefix' can't have a value of 'null' because of its type 'String', but the implicit default value is 'null'.
Try adding either an explicit non-'null' default value or the 'required' modifier.
void inheritIO(Process process, {String prefix, bool lineBased = true}) {
                                        ^^^^^^
kubeliv commented 3 years ago

I've tagged and published v4.1.0 that should fix these problems. Thanks!