simc / dartx

Superpowers for Dart. Collection of useful static extension methods.
https://pub.dev/packages/dartx
Apache License 2.0
1.08k stars 88 forks source link

Best extension design? #174

Closed ChaserVasya closed 3 months ago

ChaserVasya commented 3 months ago

This lib has next extension namings

SomeNameX
ClassMethodExtension
Method

Also, some extensions have one method, while others have several.

What's better?

This will be useful for the community when developing extensions.

passsy commented 3 months ago

122 might be interesting for you. We moved from having one extension per type to one extension per function.

The reasoning is:

For the extension name we usually only use the function name in dartx, because every extension only has a single function.

I personally hate that I have to come up with a name at all. The name could be technically derrived from the extension itself like in Kolin. See the discussion at https://github.com/dart-lang/language/issues/1627