barcodeStream property
Stream phát ra mã vạch khi máy quét phần cứng (PDA) quét thành công. Sử dụng EventChannel để lắng nghe Broadcast Intents từ hệ thống. Dùng với StreamBuilder hoặc listen() để nhận dữ liệu real-time.
Implementation
@override
Stream<String> get barcodeStream {
// Tạo mới BroadcastStream mỗi khi getter được gọi.
// EventChannel đảm bảo chỉ có một subscription thực tế đến Native,
// giúp tránh lỗi "Stream already subscribed"
// khi widget rebuild hoặc multiple listeners đăng ký.
return eventChannel.receiveBroadcastStream().cast<String>();
}