Skip to content
RED SAG Skills
medium10 pts · first answer countscross-platform-mobiledart

Adding a method to String

You want `'9876543210'.maskPhone()` to work on any String without subclassing. Which Dart feature allows this?

extension PhoneMask on String {
  String maskPhone() => replaceRange(2, 8, '******');
}
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions