Description
Instead of generating a custom singleton pattern for every icon, we could use the built-in lazy functionality.
For example:
val ArrowLeft: ImageVector
get() {
if (_ArrowLeft != null) {
return _ArrowLeft!!
}
_ArrowLeft = ImageVector.Builder(....).build()
return _ArrowLeft!!
}
private var _ArrowLeft: ImageVector? = null
becomes
val ArrowLeft: ImageVector by lazy {
ImageVector.Builder(....).build()
}
A minor thing to be sure but it does:
- Reduce indentation by one level
- Make the singleton pattern clearer
- Reduce the lines of code by
8 / per file which across something like 300 icons becomes significant
P.S. Love the plugin!
Description
Instead of generating a
customsingleton pattern for every icon, we could use thebuilt-inlazy functionality.For example:
becomes
A minor thing to be sure but it does:
8 / per filewhich across something like300icons becomes significantP.S. Love the plugin!