Flutter

Dart Language Essentials

Classes, mixins, extensions, generics, async/await, streams, error handling

15 preguntas de entrevista·
Junior
1

What is a mixin in Dart?

Respuesta

A mixin is a way to reuse code across multiple class hierarchies without using traditional inheritance. Unlike single inheritance which limits to one parent class, mixins allow composing multiple behaviors into a single class using the with keyword. This promotes a more flexible architecture and avoids the problems of multiple inheritance.

2

What is the difference between an abstract class and an interface in Dart?

Respuesta

In Dart, any class can serve as an interface using the implements keyword. The key difference is that an abstract class can contain method implementations that subclasses inherit, while an interface (via implements) forces the class to reimplement all methods. Use extends to inherit behavior and implements to guarantee a contract.

3

How to create an extension method in Dart?

Respuesta

Extension methods allow adding functionality to existing types without modifying their source code. The syntax uses the extension keyword followed by an optional name, then on TypeName to specify the extended type. This feature is particularly useful for enriching third-party library classes or native types like String or List.

4

What is the role of the async keyword in a Dart function?

5

What is the difference between Future and Stream in Dart?

+12 preguntas de entrevista

Domina Flutter para tu próxima entrevista

Accede a todas las preguntas, flashcards, tests técnicos, ejercicios de code review y simuladores de entrevista.

Empieza gratis