Skip to content

Commit

Permalink
Fixed lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen1602 committed Dec 7, 2023
1 parent a07b3fb commit 5bd4932
Show file tree
Hide file tree
Showing 60 changed files with 81 additions and 120 deletions.
3 changes: 1 addition & 2 deletions lib/lighthouse_provider/lighthouse_provider_start.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:bluez_back_end/bluez_back_end.dart';
import 'package:fake_back_end/fake_back_end.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_reactive_ble_back_end/flutter_reactive_ble_end.dart';
import 'package:flutter_web_bluetooth_back_end/flutter_web_bluetooth_back_end.dart';
Expand Down Expand Up @@ -44,7 +43,7 @@ class LighthouseProviderStart {
// you'll also need to
// import 'package:lighthouse_pm/lighthouse_back_ends/fake/fake_back_end.dart';

LighthouseProvider.instance.addBackEnd(FakeBLEBackEnd.instance);
// LighthouseProvider.instance.addBackEnd(FakeBLEBackEnd.instance);
return true;
}());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ class LighthouseMetadataState extends State<LighthouseMetadataPage> {
}

class _MetadataInkWell extends StatelessWidget {
const _MetadataInkWell(
{required this.name, this.value, this.onTap});
const _MetadataInkWell({required this.name, this.value, this.onTap});

final String name;
final String? value;
Expand Down
3 changes: 1 addition & 2 deletions lib/lighthouse_provider/widgets/lighthouse_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,7 @@ class LighthouseWidgetState extends State<LighthouseWidget> {
/// Display the state of the device together with the state as a number in hex.
class _LHItemPowerStateWidget extends StatelessWidget {
const _LHItemPowerStateWidget(
{required this.powerStateByte,
required this.toPowerState});
{required this.powerStateByte, required this.toPowerState});

final int? powerStateByte;
final _ToPowerState toPowerState;
Expand Down
1 change: 1 addition & 0 deletions lib/pages/main_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,7 @@ class _ScanDevicesPage extends State<ScanDevicesPage>
@override
void didChangeAppLifecycleState(final AppLifecycleState state) {
switch (state) {
case AppLifecycleState.hidden:
case AppLifecycleState.paused:
setState(() {
updates = 0;
Expand Down
1 change: 1 addition & 0 deletions lib/pages/shortcut/mac_shortcut_handle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class ShortcutHandleMacState extends State<ShortcutHandlerWidget>
@override
void didChangeAppLifecycleState(final AppLifecycleState state) {
switch (state) {
case AppLifecycleState.hidden:
case AppLifecycleState.paused:
cleanUp();
break;
Expand Down
4 changes: 1 addition & 3 deletions lib/pages/shortcut/states/get_device_state_stream.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ class GetDeviceStateStream extends WaterfallStreamWidget<LighthousePowerState>
final int settingsIndex;

GetDeviceStateStream(this.settingsIndex,
{super.key,
required super.upStream,
super.downStreamBuilders});
{super.key, required super.upStream, super.downStreamBuilders});

Stream<WithTimeout<LighthousePowerState>> getDeviceState(
final StatefulLighthouseDevice device, final Duration timeout) {
Expand Down
4 changes: 1 addition & 3 deletions lib/pages/shortcut/states/get_device_stream.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ class GetDeviceStream extends WaterfallStreamWidget<LighthouseDevice>
final int settingsIndex;

GetDeviceStream(this.deviceId, this.settingsIndex,
{required super.upStream,
required super.downStreamBuilders,
super.key});
{required super.upStream, required super.downStreamBuilders, super.key});

Stream<WithTimeout<LighthouseDevice?>> listenForDevice(
final Duration timeout) {
Expand Down
4 changes: 1 addition & 3 deletions lib/pages/shortcut/states/permission_stream.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import 'package:permission_handler/permission_handler.dart';
class PermissionsStream extends WaterfallStreamWidget<PermissionStatus>
with ScanningMixin, CloseCurrentRouteMixin {
PermissionsStream(
{super.key,
required super.upStream,
super.downStreamBuilders});
{super.key, required super.upStream, super.downStreamBuilders});

@override
Widget build(final BuildContext context) {
Expand Down
4 changes: 1 addition & 3 deletions lib/pages/shortcut/states/settings_stream.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import 'package:lighthouse_pm/widgets/waterfall_widget.dart';
class SettingsStream extends WaterfallStreamWidget<MainPageSettings>
with WithBlocStateless {
SettingsStream(
{super.key,
required super.upStream,
super.downStreamBuilders});
{super.key, required super.upStream, super.downStreamBuilders});

@override
Widget build(final BuildContext context) {
Expand Down
4 changes: 1 addition & 3 deletions lib/pages/shortcut_handler_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ class ShortcutHandlerPage extends BasePage {
final Object? handle;

const ShortcutHandlerPage(this.handle, {super.key})
: super(
shortcutHandleArgument: handle as ShortcutHandle?,
replace: true);
: super(shortcutHandleArgument: handle as ShortcutHandle?, replace: true);

@override
Widget buildPage(final BuildContext context) {
Expand Down
3 changes: 1 addition & 2 deletions lib/pages/simple_base_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import 'base_page.dart';
class SimpleBasePage extends BasePage {
final Widget _body;

const SimpleBasePage(this._body,
{super.key, super.shortcutHandleArgument});
const SimpleBasePage(this._body, {super.key, super.shortcutHandleArgument});

@override
Widget buildPage(final BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/content_container_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class ContentScrollbar extends StatelessWidget {
final ScrollController? controller,
required this.scrollbarChildBuilder,
this.maxSize = ContentContainerWidget.defaultMaxSize,
}) : controller = controller ?? ScrollController();
}) : controller = controller ?? ScrollController();

final ScrollbarChildBuilder scrollbarChildBuilder;

Expand Down
3 changes: 1 addition & 2 deletions lib/widgets/dao_data_create_alert_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ abstract class DaoDataCreateAlertDecorator<T> {
///
class DaoDataCreateAlertStringDecorator
extends DaoDataCreateAlertDecorator<String> {
DaoDataCreateAlertStringDecorator(
super.name, super.originalValue,
DaoDataCreateAlertStringDecorator(super.name, super.originalValue,
{this.validator});

final FormFieldValidator<String>? validator;
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/markdown/src/icon_builder.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of lighthouse_markdown;
part of '../markdown.dart';

///
/// Convert an [md.Element] to the actual [Widget] for rendering. Use [IconSyntax]
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/markdown/src/icon_syntax.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of lighthouse_markdown;
part of '../markdown.dart';

///
/// Convert an <icon>{the icon}</icon> tag into an element that can be used in
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/markdown/src/markdown_tap_link.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of lighthouse_markdown;
part of '../markdown.dart';

markdownOpenLinkOnTap(
final String text, final String? href, final String title) {
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/markdown/src/super_script_syntax.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of lighthouse_markdown;
part of '../markdown.dart';

///
/// Convert the markdown content inside the `<sup>` tag into actual super
Expand Down
4 changes: 1 addition & 3 deletions lib/widgets/waterfall_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ abstract class WaterfallStreamWidget<T> extends StatelessWidget {
final List<DownStreamBuilder> downStreamBuilders;

const WaterfallStreamWidget(
{super.key,
required this.upStream,
this.downStreamBuilders = const []});
{super.key, required this.upStream, this.downStreamBuilders = const []});

WaterfallStreamWidget getNextStreamDown(
final BuildContext context, final T? upstreamData) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of lighthouse_back_end;
part of '../../lighthouse_back_end.dart';

///
/// A back end that will use [BLEDeviceProvider]s to provide [BLEDevice]s
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of lighthouse_back_end;
part of '../../lighthouse_back_end.dart';

///
/// A back end that requires the user to pair a device before it's able to be
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of lighthouse_back_end;
part of '../../lighthouse_back_end.dart';

/// An abstract class for bluetooth characteristic.
///
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of lighthouse_back_end;
part of '../../lighthouse_back_end.dart';

/// An abstract class for bluetooth devices.
///
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of lighthouse_back_end;
part of '../../lighthouse_back_end.dart';

/// An abstract bluetooth service.
///
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of lighthouse_back_end;
part of '../../lighthouse_back_end.dart';

///
/// A device for all other devices.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of lighthouse_back_end;
part of '../../lighthouse_back_end.dart';

/// What a back end device should at least have for the providers to work with it.
abstract class LowLevelDevice {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of lighthouse_back_end;
part of '../../lighthouse_back_end.dart';

///
/// An abstract device provider specifically made for Bluetooth low energy.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of lighthouse_back_end;
part of '../../lighthouse_back_end.dart';

///
/// Extension functions for [ByteData]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of lighthouse_back_end;
part of '../../lighthouse_back_end.dart';

///
/// An abstract super class of what all device provider should be able to do.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of bluez_back_end;
part of '../bluez_back_end_io.dart';

class BlueZBluetoothCharacteristic extends LHBluetoothCharacteristic {
BlueZBluetoothCharacteristic(this.characteristic);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of bluez_back_end;
part of '../bluez_back_end_io.dart';

class BlueZBluetoothDevice extends LHBluetoothDevice {
BlueZBluetoothDevice(this.device) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of bluez_back_end;
part of '../bluez_back_end_io.dart';

class BlueZBluetoothService extends LHBluetoothService {
BlueZBluetoothService(this.service);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of fake_back_end;
part of '../../fake_back_end.dart';

class FakeBluetoothDevice extends LHBluetoothDevice {
final LHDeviceIdentifier deviceIdentifier;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of fake_back_end;
part of '../../fake_back_end.dart';

abstract class FakeDeviceIdentifier {
static LHDeviceIdentifier generateDeviceIdentifier(final int seed) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
part of flutter_reactive_ble_back_end;
part of '../flutter_reactive_ble_io.dart';

class FlutterReactiveBleCharacteristic extends LHBluetoothCharacteristic {
FlutterReactiveBleCharacteristic(
final String deviceId,
final DiscoveredCharacteristic characteristic,
final Characteristic characteristic,
) : _qualifiedCharacteristic = QualifiedCharacteristic(
characteristicId: characteristic.characteristicId,
serviceId: characteristic.serviceId,
characteristicId: characteristic.id,
serviceId: characteristic.service.id,
deviceId: deviceId),
uuid = LighthouseGuid.fromString(
characteristic.characteristicId.toString());
uuid = LighthouseGuid.fromString(characteristic.id.toString());

final QualifiedCharacteristic _qualifiedCharacteristic;
final _flutterReactiveBle = FlutterReactiveBle();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of flutter_reactive_ble_back_end;
part of '../flutter_reactive_ble_io.dart';

/// An abstraction for the [FlutterReactiveBle] bluetooth device.
class FlutterReactiveBleBluetoothDevice extends LHBluetoothDevice {
Expand Down Expand Up @@ -62,7 +62,8 @@ class FlutterReactiveBleBluetoothDevice extends LHBluetoothDevice {

@override
Future<List<LHBluetoothService>> discoverServices() async {
final services = await _flutterReactiveBle.discoverServices(device.id);
await _flutterReactiveBle.discoverAllServices(device.id);
final services = await _flutterReactiveBle.getDiscoveredServices(device.id);

return services.map((final service) {
return FlutterReactiveBleService(device.id, service);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
part of flutter_reactive_ble_back_end;
part of '../flutter_reactive_ble_io.dart';

class FlutterReactiveBleService extends LHBluetoothService {
FlutterReactiveBleService(
final String deviceId, final DiscoveredService discoveredService)
: uuid =
LighthouseGuid.fromString(discoveredService.serviceId.toString()),
final String deviceId, final Service discoveredService)
: uuid = LighthouseGuid.fromString(discoveredService.id.toString()),
characteristics =
discoveredService.characteristics.map((final characteristic) {
return FlutterReactiveBleCharacteristic(deviceId, characteristic);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of flutter_web_bluetooth_back_end;
part of '../../flutter_web_bluetooth_back_end.dart';

class FlutterWebBluetoothCharacteristic extends LHBluetoothCharacteristic {
FlutterWebBluetoothCharacteristic(this.characteristic);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of flutter_web_bluetooth_back_end;
part of '../../flutter_web_bluetooth_back_end.dart';

class FlutterWebBluetoothDevice extends LHBluetoothDevice {
FlutterWebBluetoothDevice(this.device, this.characteristicsGuid);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of flutter_web_bluetooth_back_end;
part of '../../flutter_web_bluetooth_back_end.dart';

class FlutterWebBluetoothService extends LHBluetoothService {
FlutterWebBluetoothService(this.service,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of device_extension;
part of 'device_extension.dart';

/// An interface for devices that have extra function extensions.
abstract class DeviceWithExtensions {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
part of device_extension;
part of 'device_extension.dart';

///
/// An extension to allow a device to turn on
///
class OnExtension extends StateExtension {
OnExtension(
{required final ChangeStateFunction changeState,
required final GetPowerStateStream powerStateStream})
: super(
toolTip: "On",
changeState: changeState,
powerStateStream: powerStateStream,
toState: LighthousePowerState.on);
OnExtension({required super.changeState, required super.powerStateStream})
: super(toolTip: "On", toState: LighthousePowerState.on);
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
part of device_extension;
part of 'device_extension.dart';

///
/// An extension to allow a device to go into sleep mode
///
class SleepExtension extends StateExtension {
SleepExtension(
{required final ChangeStateFunction changeState,
required final GetPowerStateStream powerStateStream})
: super(
toolTip: "Sleep",
changeState: changeState,
powerStateStream: powerStateStream,
toState: LighthousePowerState.sleep);
SleepExtension({required super.changeState, required super.powerStateStream})
: super(toolTip: "Sleep", toState: LighthousePowerState.sleep);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of device_extension;
part of 'device_extension.dart';

typedef ChangeStateFunction = Future<void> Function(
LighthousePowerState newState);
Expand All @@ -10,11 +10,11 @@ typedef GetPowerStateStream = Stream<LighthousePowerState> Function();
///
abstract class StateExtension extends DeviceExtension {
StateExtension(
{required final String toolTip,
{required super.toolTip,
required final ChangeStateFunction changeState,
required this.powerStateStream,
required this.toState})
: super(toolTip: toolTip, onTap: () => changeState(toState)) {
: super(onTap: () => changeState(toState)) {
super.streamEnabledFunction = _enabledStream;
assert(
toState != LighthousePowerState.unknown &&
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of lighthouse_provider;
part of '../../lighthouse_provider.dart';

enum BluetoothAdapterState {
unknown("unknown"),
Expand Down
Loading

0 comments on commit 5bd4932

Please sign in to comment.