Skip to content

[scrollable_positioned_list] 0.3.0 fails to compile due to null safety errors #361

@clayharris

Description

@clayharris

Problem description

Scrollable Positioned List 0.3.0 throws an error on compilation due to a failed null safety check, possibly with the Scheduler dependency? Does not occur with 0.2.3.

Steps to reproduce

  1. Add scrollable_positioned_list: ^0.3.0 to pubspec.yaml
  2. run flutter pub get
  3. Add ScrollablePositionedList.builder logic to your app (e.g. ScrollablePositionedList.builder(itemCount: 1, itemBuilder: (context, index) => Container())
  4. Compilation fails.
  • Reproduced using basic starter flutter app (android), adding just this one library, and adding the reference to the project (home: ScrollablePositionedList.builder(itemCount: 1, itemBuilder: (context, index) => MyHomePage(title: 'Flutter Demo Home Page')) ,

Expected behavior

Compilation completes and app behaves as expected.

Actual behavior

Compilation failure, unable to run app at all

Environment

MacOS Monterey 12.3.1 (M1)

Additional details

Error received:

Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
Running Gradle task 'assembleDebug'...
../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/scrollable_positioned_list-0.3.0/lib/src/scrollable_positioned_list.dart:438:33: Error: Method 'addPostFrameCallback' cannot be called on 'SchedulerBinding?' because it is potentially null.

  • 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('../../../development/flutter/packages/flutter/lib/src/scheduler/binding.dart').
    Try calling using ?. instead.
    SchedulerBinding.instance.addPostFrameCallback((_) {
    ^^^^^^^^^^^^^^^^^^^^

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions