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
Wrap your scaffold with MaterialApp
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
https://github.com/syncfusion/flutter-examples/issues/730#issuecomment-1413788831