Photo_view: Build error : Error: Can't access 'this' in a field initializer to read 'computeMaxScale' and 'computeMinScale'.

Created on 22 Aug 2018  Â·  2Comments  Â·  Source: fireslime/photo_view

This plugin is a very cool plugin! But I updated flutter version, the following build error has occurred.

  • build error
compiler message: file:///root/.pub-cache/hosted/pub.dartlang.org/photo_view-0.0.6/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:///root/.pub-cache/hosted/pub.dartlang.org/photo_view-0.0.6/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:                ^^^^^^^^^^^^^^^
Compiler terminated unexpectedly.
  • flutter doctor
% flutter doctor                                                                                                                                              (git)-[feature/setting-theme-color]
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel dev, v0.6.2, on Mac OS X 10.13.6 17G2208, locale en-JP)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.1)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
[✓] Android Studio
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] Android Studio (version 3.1)
[✓] VS Code (version 1.26.0)
[✓] Connected devices (3 available)

• No issues found!

thanks.

bug

All 2 comments

I will look into that ASAP

The as a temporary solution, I removed this problematic assert. I will release this "fix" as 0.0.7.

Also, I created a question on stack overflow about this. Once we have a more definitive solution, we can return to address this issue.

Was this page helpful?
0 / 5 - 0 ratings