Skip to content

Commit 50c9749

Browse files
committed
clean up warnings
1 parent 2c7bf76 commit 50c9749

File tree

9 files changed

+22
-29
lines changed

9 files changed

+22
-29
lines changed

lib/models/agixt/widgets/agixt_chat.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'dart:async';
22
import 'dart:convert';
3-
import 'dart:typed_data';
43
import 'package:agixt/models/agixt/auth/auth.dart';
54
import 'package:agixt/models/agixt/calendar.dart';
65
import 'package:agixt/models/agixt/checklist.dart';

lib/screens/auth/webview_login_screen.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ class _WebViewLoginScreenState extends State<WebViewLoginScreen> {
394394
}
395395

396396
/// Check page content for Phantom wallet related elements
397+
// ignore: unused_element
397398
Future<void> _checkPageForPhantomContent() async {
398399
if (_controller == null || _isAuthenticated || _hasOfferedPhantomApp) {
399400
return;
@@ -618,7 +619,7 @@ class _WebViewLoginScreenState extends State<WebViewLoginScreen> {
618619
}
619620
}
620621

621-
final token = result?.jwtToken;
622+
final token = result.jwtToken;
622623
if (token == null || token.isEmpty) {
623624
throw StateError('Wallet authentication did not return a session token.');
624625
}
@@ -792,6 +793,7 @@ class _WebViewLoginScreenState extends State<WebViewLoginScreen> {
792793
}
793794

794795
/// Try to get a nonce/message from the web page that needs to be signed
796+
// ignore: unused_element
795797
Future<String?> _getNonceFromWebPage() async {
796798
if (_controller == null) return null;
797799

@@ -841,6 +843,7 @@ class _WebViewLoginScreenState extends State<WebViewLoginScreen> {
841843
}
842844

843845
/// Inject the wallet address into the webview to complete the Phantom login
846+
// ignore: unused_element
844847
Future<void> _injectWalletAddressAndLogin(String walletAddress, {String? signature}) async {
845848
if (_controller == null) return;
846849

lib/screens/settings_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class _GlassesSettingsPageState extends State<GlassesSettingsPage> {
145145
'v0.0.68',
146146
style: TextStyle(
147147
fontSize: 12,
148-
color: theme.textTheme.bodySmall?.color?.withOpacity(0.5),
148+
color: theme.textTheme.bodySmall?.color?.withValues(alpha: 0.5),
149149
),
150150
),
151151
),

lib/services/ai_service.dart

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Service for handling AI communications with AGiXT API
22
import 'dart:async';
3-
import 'dart:typed_data';
43
import 'package:agixt/models/agixt/widgets/agixt_chat.dart';
54
import 'package:agixt/services/bluetooth_manager.dart';
65
import 'package:agixt/services/whisper.dart';
@@ -44,8 +43,8 @@ class AIService {
4443
StreamSubscription<WakeWordEvent>? _wakeWordSubscription;
4544
StreamSubscription<VoiceInputState>? _voiceInputSubscription;
4645
StreamSubscription<WatchVoiceInput>? _watchVoiceInputSubscription;
47-
StringBuffer _streamingResponse = StringBuffer();
48-
bool _isStreaming = false;
46+
final StringBuffer _streamingResponse = StringBuffer();
47+
bool _isStreaming = false; // ignore: prefer_final_fields
4948

5049
factory AIService() {
5150
return singleton;
@@ -284,10 +283,8 @@ class AIService {
284283
}
285284

286285
/// Process text input and return the response
287-
Future<String?> _processTextInput(
288-
String text, {
289-
bool isFromWatch = false,
290-
}) async {
286+
// ignore: unused_element
287+
Future<String?> _processTextInput(String text) async {
291288
try {
292289
// Use streaming for better responsiveness
293290
final responseBuffer = StringBuffer();
@@ -384,7 +381,6 @@ class AIService {
384381
// This uses tts_mode=interleaved to stream both text and audio
385382
final responseBuffer = StringBuffer();
386383
bool audioHeaderSent = false;
387-
bool hasReceivedAudio = false;
388384
bool usePhoneAudio =
389385
!_watchService.isConnected; // Track if we're using phone audio
390386
DateTime? lastGlassesUpdate;
@@ -401,7 +397,7 @@ class AIService {
401397
if (_bluetoothManager.isConnected) {
402398
final now = DateTime.now();
403399
if (lastGlassesUpdate == null ||
404-
now.difference(lastGlassesUpdate!) >
400+
now.difference(lastGlassesUpdate) >
405401
glassesUpdateInterval) {
406402
lastGlassesUpdate = now;
407403
// Send full accumulated text so far
@@ -451,7 +447,6 @@ class AIService {
451447
case ChatStreamEventType.audioChunk:
452448
// Stream audio to watch speaker or phone speaker
453449
if (event.audioData != null && audioHeaderSent) {
454-
hasReceivedAudio = true;
455450
if (!usePhoneAudio && _watchService.isConnected) {
456451
final success =
457452
await _watchService.sendAudioChunk(event.audioData!);
@@ -580,6 +575,7 @@ class AIService {
580575
}
581576

582577
/// Output response to the appropriate device(s)
578+
// ignore: unused_element
583579
Future<void> _outputResponse(String response) async {
584580
// Always display on glasses if connected
585581
if (_bluetoothManager.isConnected) {
@@ -759,6 +755,7 @@ class AIService {
759755
}
760756

761757
/// Fallback to original glasses-only recording method
758+
// ignore: unused_element
762759
Future<void> _fallbackToOriginalRecording() async {
763760
try {
764761
// First open the microphone before showing "Listening..."
@@ -818,7 +815,6 @@ class AIService {
818815
// Use streaming TTS to send audio to watch (like ESP32 does)
819816
final responseBuffer = StringBuffer();
820817
bool audioHeaderSent = false;
821-
bool hasReceivedAudio = false;
822818
bool usePhoneAudio =
823819
!_watchService.isConnected; // Track if we're using phone audio
824820
DateTime? lastGlassesUpdate;
@@ -835,7 +831,7 @@ class AIService {
835831
if (_bluetoothManager.isConnected) {
836832
final now = DateTime.now();
837833
if (lastGlassesUpdate == null ||
838-
now.difference(lastGlassesUpdate!) >
834+
now.difference(lastGlassesUpdate) >
839835
glassesUpdateInterval) {
840836
lastGlassesUpdate = now;
841837
await _bluetoothManager.sendAIResponse(
@@ -882,7 +878,6 @@ class AIService {
882878
case ChatStreamEventType.audioChunk:
883879
// Stream audio to watch speaker or phone speaker
884880
if (event.audioData != null && audioHeaderSent) {
885-
hasReceivedAudio = true;
886881
if (!usePhoneAudio && _watchService.isConnected) {
887882
final success =
888883
await _watchService.sendAudioChunk(event.audioData!);
@@ -997,7 +992,6 @@ class AIService {
997992
// Use streaming TTS to send audio to watch (like foreground mode)
998993
final responseBuffer = StringBuffer();
999994
bool audioHeaderSent = false;
1000-
bool hasReceivedAudio = false;
1001995
bool usePhoneAudio =
1002996
!_watchService.isConnected; // Track if we're using phone audio
1003997
DateTime? lastGlassesUpdate;
@@ -1014,7 +1008,7 @@ class AIService {
10141008
if (_bluetoothManager.isConnected) {
10151009
final now = DateTime.now();
10161010
if (lastGlassesUpdate == null ||
1017-
now.difference(lastGlassesUpdate!) >
1011+
now.difference(lastGlassesUpdate) >
10181012
glassesUpdateInterval) {
10191013
lastGlassesUpdate = now;
10201014
await _bluetoothManager.sendAIResponse(
@@ -1057,7 +1051,6 @@ class AIService {
10571051

10581052
case ChatStreamEventType.audioChunk:
10591053
if (event.audioData != null && audioHeaderSent) {
1060-
hasReceivedAudio = true;
10611054
if (!usePhoneAudio && _watchService.isConnected) {
10621055
final success =
10631056
await _watchService.sendAudioChunk(event.audioData!);

lib/services/audio_player_service.dart

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'dart:async';
2-
import 'dart:typed_data';
32
import 'package:flutter/foundation.dart';
43
import 'package:flutter_sound/flutter_sound.dart';
54

@@ -13,8 +12,7 @@ class AudioPlayerService {
1312
final FlutterSoundPlayer _player = FlutterSoundPlayer();
1413
bool _playerInitialized = false;
1514
bool _isPlaying = false;
16-
StreamController<Food>? _audioStreamController;
17-
StreamSubscription<Food>? _audioStreamSubscription;
15+
StreamController<Uint8List>? _audioStreamController;
1816

1917
// Audio format info (from audio.header)
2018
int _sampleRate = 24000;
@@ -60,12 +58,12 @@ class AudioPlayerService {
6058
_channels = channels;
6159

6260
debugPrint(
63-
'AudioPlayerService: Starting stream - ${_sampleRate}Hz, ${_bitsPerSample}-bit, ${_channels}ch',
61+
'AudioPlayerService: Starting stream - ${_sampleRate}Hz, $_bitsPerSample-bit, ${_channels}ch',
6462
);
6563

6664
try {
6765
// Create a new stream controller for feeding audio
68-
_audioStreamController = StreamController<Food>();
66+
_audioStreamController = StreamController<Uint8List>();
6967

7068
// Determine codec based on bits per sample
7169
Codec codec;
@@ -108,7 +106,7 @@ class AudioPlayerService {
108106

109107
try {
110108
// Feed the PCM data directly to the player
111-
await _player.feedFromStream(pcmData);
109+
await _player.feedUint8FromStream(pcmData);
112110
} catch (e) {
113111
debugPrint('AudioPlayerService: Error feeding audio: $e');
114112
}

lib/services/location_service.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ class LocationService {
102102
// Save last known position
103103
Future<void> saveLastPosition(Position position) async {
104104
try {
105-
final DateTime? timestampCandidate = position.timestamp;
106-
final timestamp = timestampCandidate ?? DateTime.now();
105+
final timestamp = position.timestamp;
107106
final payload = jsonEncode({
108107
'latitude': position.latitude,
109108
'longitude': position.longitude,

lib/services/voice_input_service.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'dart:async';
2-
import 'dart:typed_data';
32
import 'package:agixt/services/bluetooth_manager.dart';
43
import 'package:agixt/services/bluetooth_reciever.dart';
54
import 'package:agixt/services/watch_service.dart';

lib/services/wake_word_service.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,11 @@ class WakeWordService {
5555
static const _minConfidenceThreshold = 0.75;
5656

5757
// Recent audio energy tracking for noise rejection
58+
// ignore: unused_field
5859
final List<double> _recentEnergies = [];
60+
// ignore: unused_field
5961
static const _energyWindowSize = 10;
62+
// ignore: unused_field
6063
static const _minEnergyRatio = 2.0; // Audio must be 2x above ambient noise
6164

6265
// Model info - using small English model (~50MB)

lib/services/wallet_adapter_service.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import 'package:device_info_plus/device_info_plus.dart';
66
import 'package:flutter/foundation.dart';
77
import 'package:flutter/services.dart';
88
import 'package:solana_wallet_adapter/solana_wallet_adapter.dart';
9-
import 'package:solana_wallet_adapter_platform_interface/src/exceptions/solana_wallet_adapter_exception.dart';
109
import 'package:url_launcher/url_launcher.dart';
1110

1211
/// Centralized helper for interacting with the Solana Mobile Wallet Adapter.

0 commit comments

Comments
 (0)