Flutter

Dart Language Essentials

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

15 คำถามสัมภาษณ์·
Junior
1

What is a mixin in Dart?

คำตอบ

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?

คำตอบ

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?

คำตอบ

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 คำถามสัมภาษณ์

เชี่ยวชาญ Flutter สำหรับการสัมภาษณ์ครั้งถัดไป

เข้าถึงคำถามทั้งหมด flashcards แบบทดสอบเทคนิค แบบฝึกหัด code review และตัวจำลองสัมภาษณ์

เริ่มใช้ฟรี