optimist-dev/scrolls_to_top

The non-abstract class '_FakeScrollContext' is missing implementations for these members: ScrollContext.devicePixelRatio

Closed this issue · 3 comments

arnab commented

Hello,

When I upgrade to the latest stable releases of Flutter (3.13.0-stable) and Dart (3.1.0), I get this error while building the ipa or appbundle.

My app was working fine with Flutter 3.10.6-stable and Dart 3.0.6.

The newest version of Flutter fixes a sever jank issue on iOS 16.6: Lagging in iOS 16.6 iPhone high frame rates devices · Issue #131319 · flutter/flutter, so this is quite an urgent issue for us to fix.

Output/Failures

flutter build appbundle
/root/.pub-cache/hosted/pub.dev/scrolls_to_top-2.1.0/lib/scrolls_to_top.dart:122:7: Error: The non-abstract class '_FakeScrollContext' is missing implementations for these members:
 - ScrollContext.devicePixelRatio
Try to either
 - provide an implementation,
 - inherit an implementation from a superclass or mixin,
 - mark the class as abstract, or
 - provide a 'noSuchMethod' implementation.
class _FakeScrollContext extends ScrollContext {
      ^^^^^^^^^^^^^^^^^^
/root/flutter-sdk/flutter/packages/flutter/lib/src/widgets/scroll_context.dart:47:14: Context: 'ScrollContext.devicePixelRatio' is defined here.
  double get devicePixelRatio;
             ^^^^^^^^^^^^^^^^
/root/.pub-cache/hosted/pub.dev/skeletonizer-0.2.0/lib/src/utils.dart:41:17: Error: The argument type 'RenderObject' can't be assigned to the parameter type 'AbstractNode'.
 - 'RenderObject' is from 'package:flutter/src/rendering/object.dart' ('/root/flutter-sdk/flutter/packages/flutter/lib/src/rendering/object.dart').
 - 'AbstractNode' is from 'package:flutter/src/foundation/node.dart' ('/root/flutter-sdk/flutter/packages/flutter/lib/src/foundation/node.dart').
    return find(this);
                ^
Target kernel_snapshot failed: Exception
FAILURE: Build failed with an exception.
flutter build ipa
Xcode archive done.                                         118.7s
Failed to build iOS app
Error (Xcode): ../../../../.pub-cache/hosted/pub.dev/scrolls_to_top-2.1.0/lib/scrolls_to_top.dart:122:7: Error: The non-abstract class '_FakeScrollContext' is missing implementations for
these members:


Encountered error while archiving for device.

Flutter doctor

$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.0, on macOS 13.4.1 22F770820d darwin-arm64, locale en-CA)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.78.2)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!

I tried to fix it。 It seems to be fine.

Tty it as following.

scrolls_to_top:
git:
url: https://github.com/changweihua/scrolls_to_top.git

arnab commented

Thanks for creating a PR too, @changweihua! Linking it here: #12.

Yes, with this change, my app is able to build the ipa/appbundle. Here is what I have in pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  # ... more dependencies #
  # FIXME: Once https://github.com/optimist-dev/scrolls_to_top/pull/12 is merged, we can go back to
  #   use the official package from pub with a newer version.
  scrolls_to_top:
    git:
      url: https://github.com/changweihua/scrolls_to_top.git
      ref: 5d15e145734a375f6deb717e65a6aa3220da7545
otopba commented

Fixed by #12