jeudi 21 janvier 2021

Flutter Abstract Factory Design usage

I have two question types (with the potential to become more). Each of these question types has different widgets and different state objects. However, all the state objects must inherit from an abstract class, Question.

I will be creating them dynamically (because they are coming from a database). I can tell the question types apart because each has a property called "question_type" in the database.

I am considering using the Abstract Factory design pattern to create them and I want to know if it is the right approach. Each widget is only compatible with it's designated question type. ie. MCQuestionWidget will be compatible with MCQuestion.

Factory

Aucun commentaire:

Enregistrer un commentaire