Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: PageView Interactive Example leads to non-nullable error #79395

Closed
imcrisanto opened this issue Mar 30, 2021 · 3 comments
Closed

docs: PageView Interactive Example leads to non-nullable error #79395

imcrisanto opened this issue Mar 30, 2021 · 3 comments
Labels
a: null-safety Support for the Dart's team new null safety feature a: quality A truly polished experience d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos f: material design flutter/packages/flutter/material repository. found in release: 2.0 Found to occur in 2.0 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on

Comments

@imcrisanto
Copy link

PROBLEM

const MyApp({Key? key}) : super(key: key);

I have noticed an error with the documentation specifically the PageView Interactive Example which leads to this error

error: This requires the 'non-nullable' language feature to be enabled. (experiment_not_enabled at [examenapp] lib/main.dart:12)

FIX (removing the ? allows my app to run)

const MyApp({Key key}) : super(key: key);

Can anyone from the flutter team verify that this is correct? If this is correct I believe the documentation should be updated to reflect this change. packages/flutter/lib/src/widgets/page_view.dart

Doctor summary (to see all details, run flutter doctor -v):

[✓] Flutter (Channel stable, 2.0.2, on macOS 11.2.3 20D91 darwin-x64)
• Flutter version 2.0.2
• Framework revision 8962f6d (3 weeks ago), 2021-03-11 13:22:20 -0800
• Engine revision 5d8bf81
• Dart version 2.12.1

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Platform android-30, build-tools 30.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.10.1

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.53.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.19.0

[✓] Connected device (2 available)
• iPhone 12 (mobile) • 7BA42098-B278-4472-9B69-43554D46C7C6 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.90

• No issues found!

@darshankawar darshankawar added the in triage Presently being triaged by the triage team label Mar 31, 2021
@darshankawar
Copy link
Member

Document source: https://api.flutter.dev/flutter/widgets/PageView-class.html#widgets.PageView.1

The null safety version option is selected by default which runs properly, but if we unselect that option, then compile errors related to null safety are shown:

Screenshot 2021-03-31 at 1 09 45 PM

May be after unselecting the null safety version, the example should update accordingly to avoid this error and experience.

A similar issue is with https://flutter.dev/docs/cookbook/navigation/navigate-with-arguments#interactive-example, wherein, it runs after unselecting null safety version, but throws null safety compile errors after selecting the option back,

@darshankawar darshankawar added a: null-safety Support for the Dart's team new null safety feature a: quality A truly polished experience d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos documentation f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. found in release: 2.0 Found to occur in 2.0 has reproducible steps The issue has been confirmed reproducible and is ready to work on and removed in triage Presently being triaged by the triage team labels Mar 31, 2021
@imcrisanto
Copy link
Author

imcrisanto commented Mar 31, 2021

Hi, @darshankawar thanks for answering my question! I will update my code to reflect the NULL SAFETY change :)

@github-actions
Copy link

github-actions bot commented Aug 3, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: null-safety Support for the Dart's team new null safety feature a: quality A truly polished experience d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos f: material design flutter/packages/flutter/material repository. found in release: 2.0 Found to occur in 2.0 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on
Projects
None yet
Development

No branches or pull requests

2 participants