Intermediate Flutter
Q68 / 100

What is a factory constructor in Dart?

Correct! Well done.

Incorrect.

The correct answer is B) A constructor that can return an existing instance, a subtype, or use logic before creating — not required to create a new instance

B

Correct Answer

A constructor that can return an existing instance, a subtype, or use logic before creating — not required to create a new instance

Explanation

A factory constructor uses the factory keyword and does not always create a new instance — it can return a cached instance, a subtype, or compute the value. Commonly used for singletons, fromJson() deserializers, and named constructors.

Progress
68/100