Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
E
esc_pos_print_plus
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dio Maulana
esc_pos_print_plus
Commits
4d83fd23
Commit
4d83fd23
authored
Jan 15, 2020
by
Andrey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
_isScanning stream fixed.
parent
57840358
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
printer_bluetooth_manager.dart
lib/src/printer_bluetooth_manager.dart
+5
-5
No files found.
lib/src/printer_bluetooth_manager.dart
View file @
4d83fd23
...
...
@@ -35,14 +35,14 @@ class PrinterBluetooth {
/// Printer Bluetooth Manager
class
PrinterBluetoothManager
{
final
BluetoothManager
_bluetoothManager
=
BluetoothManager
.
instance
;
bool
_isScanning
=
false
;
bool
_isPrinting
=
false
;
bool
_isConnected
=
false
;
StreamSubscription
_scanResultsSubscription
;
StreamSubscription
_isScanningSubscription
;
PrinterBluetooth
_selectedPrinter
;
Stream
<
bool
>
get
isScanningStream
=>
_bluetoothManager
.
isScanning
;
final
BehaviorSubject
<
bool
>
_isScanning
=
BehaviorSubject
.
seeded
(
false
);
Stream
<
bool
>
get
isScanningStream
=>
_isScanning
.
stream
;
final
BehaviorSubject
<
List
<
PrinterBluetooth
>>
_scanResults
=
BehaviorSubject
.
seeded
([]);
...
...
@@ -64,11 +64,11 @@ class PrinterBluetoothManager {
_isScanningSubscription
=
_bluetoothManager
.
isScanning
.
listen
((
isScanningCurrent
)
async
{
// If isScanning value changed (scan just stopped)
if
(
_isScanning
&&
!
isScanningCurrent
)
{
if
(
_isScanning
.
value
&&
!
isScanningCurrent
)
{
_scanResultsSubscription
.
cancel
();
_isScanningSubscription
.
cancel
();
}
_isScanning
=
isScanningCurrent
;
_isScanning
.
add
(
isScanningCurrent
)
;
});
}
...
...
@@ -85,7 +85,7 @@ class PrinterBluetoothManager {
if
(
_selectedPrinter
==
null
)
{
throw
Exception
(
'Print failed (Select a printer first)'
);
}
if
(
_isScanning
)
{
if
(
_isScanning
.
value
)
{
throw
Exception
(
'Print failed (scanning in progress)'
);
}
if
(
_isPrinting
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment