Reputation: 621
Its init in the constructor and it returns set of the strings.
private val listener: () -> Set<String> = {
NotificationManagerCompat.getEnabledListenerPackages(context)
}
But for some reason I am not able to call .contains()
function when I'm calling listener.contains("package")
It says
Upvotes: 1
Views: 245
Reputation: 2009
listener
is a lambda of type () -> Set<String
in order to use contains()
you need listener
's value which is Set<>
You can achieve this buy using invoke()
as @Михаил Нафталь mentioned:
listener.invoke().contains("value")
or:
listener().contains("value")
Invoking a function type instance
Upvotes: 3