Skip to content

Fix Flutter web build compilation errors#2

Merged
MrAlders0n merged 4 commits into
mainfrom
copilot/fix-deploy-yml-formatting
Jan 16, 2026
Merged

Fix Flutter web build compilation errors#2
MrAlders0n merged 4 commits into
mainfrom
copilot/fix-deploy-yml-formatting

Conversation

Copy link
Copy Markdown

Copilot AI commented Jan 16, 2026

The Flutter web build was failing due to type conflicts between platform-specific Bluetooth packages and API incompatibilities with geolocator v11.x.

Changes

Bluetooth service type conflicts

  • Added import aliases (as fbp, as fwb) to resolve BluetoothService class name collisions between flutter_blue_plus, flutter_web_bluetooth, and local implementation
  • Used dynamic types for web Bluetooth characteristics to handle WebBluetoothRemoteGATTCharacteristic from flutter_web_bluetooth
  • Added type-safe ByteData → Uint8List conversion:
if (value is ByteData) {
  buffer = value.buffer.asUint8List(value.offsetInBytes, value.lengthInBytes);
} else if (value is Uint8List) {
  buffer = value;
}

Geolocator API update

  • Replaced deprecated locationSettings parameter in getCurrentPosition() with direct desiredAccuracy and timeLimit parameters for web platform compatibility
  • getPositionStream() continues using LocationSettings (still supported API)

Files Modified

  • lib/services/bluetooth/mobile_bluetooth.dart - Import aliasing
  • lib/services/bluetooth/web_bluetooth.dart - Type handling and data conversion
  • lib/services/gps_service.dart - API parameter updates
Original prompt

Look at my last github action.

The web app is failing to build in my github action

Fix formatting and update deploy.yml for GitHub Pages #4


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits January 16, 2026 01:24
Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix formatting and update deploy.yml for GitHub Pages Fix Flutter web build compilation errors Jan 16, 2026
Copilot AI requested a review from MrAlders0n January 16, 2026 01:30
@MrAlders0n MrAlders0n marked this pull request as ready for review January 16, 2026 02:03
Copilot AI review requested due to automatic review settings January 16, 2026 02:03
@MrAlders0n MrAlders0n merged commit 9853a08 into main Jan 16, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes compilation errors in the Flutter web build caused by type conflicts between platform-specific Bluetooth packages and API changes in geolocator v11.x.

Changes:

  • Added import aliases to resolve BluetoothService class name collisions between flutter_blue_plus and flutter_web_bluetooth packages
  • Updated web Bluetooth characteristics to use dynamic type and added type-safe data conversion handling for ByteData/Uint8List
  • Replaced deprecated locationSettings parameter with direct desiredAccuracy and timeLimit parameters in getCurrentPosition() calls for geolocator v11.x compatibility

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
lib/services/bluetooth/mobile_bluetooth.dart Added as fbp import alias to resolve type conflicts with flutter_blue_plus
lib/services/bluetooth/web_bluetooth.dart Added as fwb import alias, used dynamic for characteristics, and implemented type-safe ByteData/Uint8List conversion
lib/services/gps_service.dart Updated getCurrentPosition() calls to use direct parameters instead of deprecated locationSettings

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +20 to +21
dynamic _rxCharacteristic; // Using dynamic to handle WebBluetoothRemoteGATTCharacteristic
dynamic _txCharacteristic; // Using dynamic to handle WebBluetoothRemoteGATTCharacteristic
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using dynamic types for characteristics bypasses type safety. Consider declaring the actual type from the flutter_web_bluetooth package (e.g., fwb.BluetoothCharacteristic) to maintain compile-time type checking and enable IDE autocomplete. If the actual type isn't exported, consider adding a type alias or filing an issue with the package maintainers.

Suggested change
dynamic _rxCharacteristic; // Using dynamic to handle WebBluetoothRemoteGATTCharacteristic
dynamic _txCharacteristic; // Using dynamic to handle WebBluetoothRemoteGATTCharacteristic
fwb.BluetoothCharacteristic? _rxCharacteristic;
fwb.BluetoothCharacteristic? _txCharacteristic;

Copilot uses AI. Check for mistakes.
Comment on lines +157 to 159
} catch (e) {
// Silently ignore conversion errors
}
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Silently ignoring conversion errors could hide bugs and make debugging difficult in production. Consider logging the error or at minimum logging to debug console in debug mode, e.g., if (kDebugMode) { print('Bluetooth data conversion error: $e'); }.

Copilot uses AI. Check for mistakes.
@MrAlders0n MrAlders0n deleted the copilot/fix-deploy-yml-formatting branch February 17, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants