Gradle Android Plugin - add custom flavor attribute?

Is there any way to add custom attributes to productFlavor or buildType in android plugin for gradle?
I'd like to have such additional flexibility in configuration of buildVariants, so that I can check my custom property when specifying tasks for buildVariants.

so here you can see I've added custom attribute "useWidevineAppDrmLib" to build flavor.
It would be nice to see the same attribute in buildVariant.mergedFlavor, so that I can check that attribute value and do build additional tasks, such as package additional .so files when the attribute is set to true:

There's an alternative solution which doesn't require the creation of your own custom class. You can utilize the already existing extras property which is already attached to the 'productFlavors' class. This was specifically designed to allow custom user defined variables.

Then you can later reference like so. Note, if you didn't add the custom variable to other productFlavors you'll need to be sure to check for it first, else gradle will complain about not finding the property.