Skip to content

Commit

Permalink
S
Browse files Browse the repository at this point in the history
  • Loading branch information
shajin-screl committed Nov 4, 2024
1 parent 2938fab commit 498e2a8
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 24 deletions.
11 changes: 0 additions & 11 deletions .vscode/settings.json

This file was deleted.

12 changes: 7 additions & 5 deletions lib/src/printer_bluetooth_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import 'dart:async';
import 'dart:io';
import 'package:esc_pos_utils_plus/esc_pos_utils_plus.dart';
import 'package:esc_pos_utils/esc_pos_utils.dart';
import 'package:rxdart/rxdart.dart';
import 'package:flutter_bluetooth_basic/flutter_bluetooth_basic.dart';
import './enums.dart';
Expand All @@ -35,7 +35,8 @@ class PrinterBluetoothManager {
final BehaviorSubject<bool> _isScanning = BehaviorSubject.seeded(false);
Stream<bool> get isScanningStream => _isScanning.stream;

final BehaviorSubject<List<PrinterBluetooth>> _scanResults = BehaviorSubject.seeded([]);
final BehaviorSubject<List<PrinterBluetooth>> _scanResults =
BehaviorSubject.seeded([]);
Stream<List<PrinterBluetooth>> get scanResults => _scanResults.stream;

Future _runDelayed(int seconds) {
Expand All @@ -51,9 +52,10 @@ class PrinterBluetoothManager {
_scanResults.add(devices.map((d) => PrinterBluetooth(d)).toList());
});

_isScanningSubscription = _bluetoothManager.isScanning.listen((isScanningCurrent) async {
_isScanningSubscription =
_bluetoothManager.isScanning.listen((isScanningCurrent) async {
// If isScanning value changed (scan just stopped)
if (_isScanning.value && !isScanningCurrent) {
if (_isScanning.value! && !isScanningCurrent) {
_scanResultsSubscription!.cancel();
_isScanningSubscription!.cancel();
}
Expand All @@ -79,7 +81,7 @@ class PrinterBluetoothManager {
const int timeout = 5;
if (_selectedPrinter == null) {
return Future<PosPrintResult>.value(PosPrintResult.printerNotSelected);
} else if (_isScanning.value) {
} else if (_isScanning.value!) {
return Future<PosPrintResult>.value(PosPrintResult.scanInProgress);
} else if (_isPrinting) {
return Future<PosPrintResult>.value(PosPrintResult.printInProgress);
Expand Down
13 changes: 5 additions & 8 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@ version: 0.4.1
homepage: https://github.com/andrey-ushakov/esc_pos_bluetooth

environment:
sdk: ">=3.3.1 <4.0.0"
sdk: ">=2.18.4 <3.0.0"

dependencies:
flutter:
sdk: flutter
rxdart: ^0.28.0
esc_pos_utils_plus: ^2.0.4
rxdart: ^0.26.0
esc_pos_utils: ^1.1.0
# esc_pos_utils:
# git:
# url: https://github.com/shajin-screl/esc_pos_utils_isselo.git
flutter_bluetooth_basic:
git:
url: https://github.com/screlinfo/flutter_bluetooth_basic_isselo
# path: ../esc_pos_utils
flutter_bluetooth_basic: ^0.1.7

dev_dependencies:
flutter_test:
Expand Down
9 changes: 9 additions & 0 deletions test/esc_pos_bluetooth_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import 'package:flutter_test/flutter_test.dart';

import 'package:esc_pos_bluetooth/esc_pos_bluetooth.dart';

void main() {
test('Tests not implemented', () {
expect(1, 1);
});
}

0 comments on commit 498e2a8

Please sign in to comment.