Skip to content

Lack of clarity for the prefix 'get' for global functions. #7285

@polina-c

Description

@polina-c

Page URL

https://dart.dev/effective-dart/design

Page source

https://github.com/dart-lang/site-www/blob/main/src/content/effective-dart/design.md

Describe the problem

There are two rules that create room for interpretation:

  1. https://dart.dev/effective-dart/design#avoid-starting-a-method-name-with-get
  2. https://dart.dev/effective-dart/design#consider-an-imperative-verb-phrase-for-a-function-or-method-if-you-want-to-draw-attention-to-the-work-it-performs

If I have a global function (not method) that returns a value, is it recommended to give it prefix 'get':

  1. getMostImportantValue()
  2. mostImportantValue()

Expected fix

It would be nice to see this case clarified in effective dart to help teams save time arguing about interpretation.

Additional context

No response

I would like to fix this problem.

  • I will try and fix this problem on dart.dev.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a.effective-dartRelates to the best practices explained in Effective Dartact.questionRelates to issues that writers need SME helpe2-daysCan complete in < 5 days of normal, not dedicated, workfrom.page-issueReported in a reader-filed concernp2-mediumNecessary but not urgent concern. Resolve when possible.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions