Skip to content

remove unnecessary string interpolations - #49352

Merged
fluttergithubbot merged 1 commit into
flutter:masterfrom
a14n:remove-unnecessary-string-interpolations
Jan 24, 2020
Merged

remove unnecessary string interpolations#49352
fluttergithubbot merged 1 commit into
flutter:masterfrom
a14n:remove-unnecessary-string-interpolations

Conversation

@a14n

@a14n a14n commented Jan 23, 2020

Copy link
Copy Markdown
Contributor

Description

Remove unnecessary string interpolations

Related Issues

None

Tests

None

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read Handling breaking changes.

  • No, no existing tests failed, so this is not a breaking change.
@fluttergithubbot fluttergithubbot added a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) a: internationalization Supporting other languages or locales. (aka i18n) a: tests "flutter test", flutter_test, or one of our tests d: examples Sample code and demos p: material_ui material_ui package in flutter/packages framework flutter/packages/flutter repository. See also f: labels. c: contributor-productivity Team-specific productivity, code health, technical debt. customer: gallery Relating to flutter/gallery repository. Please transfer non-framework issues there. tool Affects the "flutter" command-line tool. See also t: labels. labels Jan 23, 2020

@Piinks Piinks 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! Thank you!
I aded a nit below that you can choose to use or ignore. :)

cells: <DataCell>[
DataCell(Text('${dessert.name}')),
DataCell(Text(dessert.name)),
DataCell(Text('${dessert.calories}')),

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.

Are some of these needing interpolation? (Other than those appending '%')

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the other are not String. The string interpolation is used to convert the value to String. They could be replaced by expression.toString() (in this case where a string is needed as Text argument). '${expression}' vs. expression.toString() : not sure I can find a winner.

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.

sgtm!

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.

FWIW, I would have left this one as-is because now there's weird inconsistencies from line to line.

@fluttergithubbot

Copy link
Copy Markdown
Contributor

This pull request is not suitable for automatic merging in its current state.

  • Please get at least one approved review before re-applying this label. Reviewers: If you left a comment approving, please use the "approve" review action instead.
@fluttergithubbot
fluttergithubbot merged commit 92cbaa3 into flutter:master Jan 24, 2020
@a14n
a14n deleted the remove-unnecessary-string-interpolations branch January 24, 2020 05:18
@dnfield

dnfield commented Jan 28, 2020

Copy link
Copy Markdown
Contributor

Some of these were guarding null - in particular, in _isolates_io.dart, debugLabel could be null.

Returning the uninterpolated value results in returning null instead of 'null'. This is causing crashes for some people in release mode.

@a14n

a14n commented Jan 28, 2020

Copy link
Copy Markdown
Contributor Author

Some of these were guarding null - in particular, in _isolates_io.dart, debugLabel could be null.

I just checked. It looks like it was the only place guarding null.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) a: internationalization Supporting other languages or locales. (aka i18n) a: tests "flutter test", flutter_test, or one of our tests c: contributor-productivity Team-specific productivity, code health, technical debt. customer: gallery Relating to flutter/gallery repository. Please transfer non-framework issues there. d: examples Sample code and demos framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages tool Affects the "flutter" command-line tool. See also t: labels.

7 participants