'Is It Possible To Make One Parameter Can Accept Value/Dat from Different Function/Data Type?

I have two model dart. The one is PromoModel and the other one is DealsModel but the model has a similar structure (but not the same).

I only need one page (details page of promos and deals). So I thought, maybe it would be too redundant to have to create 2 detail pages, which are UI-like they are the same, and only differ from the parameters.

I see a lot of Functions or Classes that accept value/data with data type T. So is it possible to create only one class (UI/Page View) but can accept different Data types (in my case it is List PromoModel and DealsModel)?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source