Skip to content

Allow extension monkey patching #2169

@cedvdb

Description

@cedvdb

Overwriting behavior via extension can be handy to sneak in added behaviors / fixes without changing the API

void main() {
  't-e-s-t'.split('-');
  print('done');
}

extension MonkeyPatch on String {
  split(Pattern pattern) {
    print('splitting');
    this.split(pattern); // maybe not "this"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureProposed language feature that solves one or more problems

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions