After running flutter upgrade
I'm facing some problems with flutter
I have this class that stores minScale
and maxScale
.
In the constructor, I want to assert the interval between them. As those values can be a double or an instance of an enum, I have to compute them before the comparison.
Code of the constructor and asserts:
class ScaleBoundaries {
final dynamic _minScale;
final dynamic _maxScale;
Size size;
ImageInfo imageInfo;
ScaleBoundaries(this._minScale, this._maxScale, { @required this.size, @required this.imageInfo}) :
assert(_minScale is double || _minScale is PhotoViewScaleBoundary),
assert(_maxScale is double || _maxScale is PhotoViewScaleBoundary),
assert(computeMinScale() <= computeMaxScale());
This gives me the following error:
compiler message: file:///.../photo_view/lib/photo_view_scale_boundaries.dart:14:37: Error: Can't access 'this' in a field initializer to read 'computeMaxScale'.
compiler message: assert(computeMinScale() <= computeMaxScale());
compiler message: ^^^^^^^^^^^^^^^
compiler message: file:///.../photo_view/lib/photo_view_scale_boundaries.dart:14:16: Error: Can't access 'this' in a field initializer to read 'computeMinScale'.
compiler message: assert(computeMinScale() <= computeMaxScale());
compiler message: ^^^^^^^^^^^^^^^
That is my flutter doctor output:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v0.7.1-pre.15, on Linux, locale en_US.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK 28.0.1)
✗ Android license status unknown.
[✓] Android Studio (version 3.1)
[✓] IntelliJ IDEA Community Edition (version 2018.1)
[!] VS Code (version 1.25.1)
[✓] Connected devices (1 available)
! Doctor found issues in 2 categories.
The only solution that I found out is removing the assert, but that is not okay. How can I address that?
For more information, see the whole file and project: photo_view_scale_boundaries.dart