skip to Main Content

This error happens as soon as I add the import statement:
import 'package:syncfusion_flutter_datepicker/datepicker.dart';
Remaining code is not needed to recreate this error

Code:

import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_datepicker/datepicker.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // static const String _title = 'Flutter Code Sample';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Container(
          child: SfDateRangePicker(),
        ));
  }
}

Error:

../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_datepicker-20.4.48/lib/src/date_picker/date_picker.dart:7596:37: Error: The argument type 'ScrollableState?' can't be assigned to the parameter type 'ScrollableState' because 'ScrollableState?' is nullable and 'ScrollableState' isn't.
 - 'ScrollableState' is from 'package:flutter/src/widgets/scrollable.dart' ('../../snap/flutter/common/flutter/packages/flutter/lib/src/widgets/scrollable.dart').
        scrollableState: Scrollable.of(context),

2

Answers


  1. Wrap your scaffold with MaterialApp

    void main() {
      runApp(const MyApp());
    }
    
    class MyApp extends StatelessWidget {
      const MyApp({super.key});
    
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
            home: Scaffold(
          body: SfDateRangePicker(),
        ));
      }
    }
    
    Login or Signup to reply.
  2. This error is mentioned on this issue.

    https://github.com/syncfusion/flutter-examples/issues/730

    You should fix version of syncfusion_flutter_datepicker in pubspec.yaml

        Don't use version:
        syncfusion_flutter_datepicker: ^20.4.48
    
        Use like this:
        syncfusion_flutter_datepicker: "20.4.44"
    

    https://github.com/syncfusion/flutter-examples/issues/730#issuecomment-1413788831

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search