You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SDK issue 40678 is concerned with a breaking change which will be performed in the Dart language and core libraries: The constant constructors int.fromEnvironment and String.fromEnvironment will have default values 0 and "", respectively, for the parameter named defaultValue.
This means that the following usages in protobuf will have a new semantics (and presumably will not work as intended):
The expressions should be changed as follows in order to work:
// Current formString path =constString.fromEnvironment('testfile') ??'testdata/500.pb';
// New form that will work also after the breaking change has occurred.String path =constbool.hasEnvironment('testfile')
?constString.fromEnvironment('testfile')
:'testdata/500.pb';
The constructor bool.hasEnvironment has been added to Dart as of dart-lang/sdk@4aba581. Until that commit is available, it is possible to replace const bool.hasEnvironment('testfile') by (const String.fromEnvironment('testfile', defaultValue: 'a') == const String.fromEnvironment('testfile', defaultValue: 'b')).
The text was updated successfully, but these errors were encountered:
It seems like this was fixed by f611f23. I checked uses of fromEnvironment methods. We don't use int.fromEnvironment, and for String.fromEnvironment we always specify the default values:
SDK issue 40678 is concerned with a breaking change which will be performed in the Dart language and core libraries: The constant constructors
int.fromEnvironment
andString.fromEnvironment
will have default values0
and""
, respectively, for the parameter nameddefaultValue
.This means that the following usages in protobuf will have a new semantics (and presumably will not work as intended):
The expressions should be changed as follows in order to work:
The constructor
bool.hasEnvironment
has been added to Dart as of dart-lang/sdk@4aba581. Until that commit is available, it is possible to replaceconst bool.hasEnvironment('testfile')
by(const String.fromEnvironment('testfile', defaultValue: 'a') == const String.fromEnvironment('testfile', defaultValue: 'b'))
.The text was updated successfully, but these errors were encountered: