Description
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 like300
icons becomes significant
P.S. Love the plugin!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
No labels