Thread constructor
Thread({
- required dynamic onMessage(),
Constructs a Thread with the given onMessage
callback.
The constructor generates a unique ID for the thread, initializes the readyState completer, and calls the init method to set up the thread.
Implementation
Thread({
required this.onMessage,
}) {
id = generateUniqueId();
readyState = Completer();
init();
}