Skip to content

fix compile error in the example code#103261

Merged
fluttergithubbot merged 1 commit into
flutter:masterfrom
ktakayama:patch-1
May 10, 2022
Merged

fix compile error in the example code#103261
fluttergithubbot merged 1 commit into
flutter:masterfrom
ktakayama:patch-1

Conversation

@ktakayama

@ktakayama ktakayama commented May 7, 2022

Copy link
Copy Markdown
Contributor

Changes only documentation.

This sample code has compile error on my machine.

$ flutter --version
Flutter 2.10.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 5464c5bac7 (3 weeks ago) • 2022-04-18 09:55:37 -0700
Engine • revision 57d3bac3dd
Tools • Dart 2.16.2 • DevTools 2.9.2

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard Bot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels May 7, 2022
@google-cla

google-cla Bot commented May 7, 2022

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

For more information, open the CLA check for this pull request.

@ktakayama

Copy link
Copy Markdown
Contributor Author

I signed CLA

@goderbauer goderbauer May 9, 2022

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To ensure that we never break this example code again, it would be best to wrap this in a {@tool snippet} section similarly to how it is done here:

/// {@tool snippet}
///
/// Given an [AnimationController] `_controller`, the following code creates
/// an `Animation<Alignment>` that swings from top left to top right as the
/// controller goes from 0.0 to 1.0:
///
/// ```dart
/// Animation<Alignment> _alignment1 = _controller.drive(
/// AlignmentTween(
/// begin: Alignment.topLeft,
/// end: Alignment.topRight,
/// ),
/// );
/// ```
/// {@end-tool}

That way, this example gets analyzed by the analyzer and doesn't break that easily. Would you be up for refactoring that?

@goderbauer

Copy link
Copy Markdown
Member

To fix one of the analyzer errors you probably need to create an "Examples can assume:" section and add _throwShotAway to it, similar to how it is done here:

// Examples can assume:
// class Cat { }

@ktakayama

ktakayama commented May 10, 2022

Copy link
Copy Markdown
Contributor Author

Thank you.
I'll try it later.

@ktakayama ktakayama force-pushed the patch-1 branch 2 times, most recently from 7881862 to ce43be5 Compare May 10, 2022 08:12

@goderbauer goderbauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@justinmc justinmc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the fix 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants