Skip to content

proposal: sort_public_methods_before_private_methods #58910

Closed
@zellidev0

Description

@zellidev0

sort_public_methods_before_private_methods

Description

Define public methods before private methods.

Details

DO define public methods before private methods.

This makes the code uniform across multiple classes and it makes it faster to find specific methods in a class.
Because public methods are the interface to the class they are (often) more important and should come before private methods.

This would be my first approach to have a defined order for different parts in a class.
Flutter style guide ordering of class members

Kind

Style

Good Examples

class A {
  int a() => 0;
  int c() => 0;
  int _b() => 0;
}

Bad Examples

class A {
  int a() => 0;
  int _b() => 0;
  int c() => 0;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions