I'd be cautious till you know what it is. The are a lot of plants in the nightshade family, and it can be easy to mistake an edible plant from a toxic plant if you are not familiar with them.
All nightshade plants contain compounds called alkaloids. One alkaloid found in nightshade vegetables, solanine, may be toxic in large quantities or in a green potato. There’s no evidence solanine is harmful in typical food amounts. And solanine isn’t only found in nightshades—blueberries, huckleberries, and artichokes contain it, too.
In green tomatoes, there is still a higher concentration of solanine, than ripe tomatoes.
If it's an eggplant though, you should be fine using green fruit. However the rest of the plant is indeed toxic.
Take belladonna for example. It does have medical uses, and making a tea from it has been used as a mild sedative for a long time. However, it can kill you do to the alkaloids found in it. It's also in the nightshade family.
I would not feed your ducks anything till you are 100% sure, and maybe then still not. Personally I'd just enjoy it for the beauty.