constants.dart 951 B

1234567891011121314151617181920
  1. import 'dart:io';
  2. abstract final class AppConstants {
  3. // On the Android emulator `localhost` points at the emulator itself, not the
  4. // dev machine. `10.0.2.2` is the emulator's alias for the host loopback, so
  5. // it is the correct default there. Physical devices must set the host
  6. // explicitly to the dev machine's LAN IP via the server settings dialog.
  7. static String get defaultHost =>
  8. Platform.isAndroid ? '192.168.199.195' : '127.0.0.1';
  9. static const defaultPort = 8765;
  10. static const targetSampleRate = 16000;
  11. static const bufferSize = 4096;
  12. static const transcribeInterval = Duration(seconds: 2);
  13. static const audioSendInterval = Duration(milliseconds: 300);
  14. static const maxAudioChunkBytes = 16000;
  15. static const pingInterval = Duration(seconds: 30);
  16. static const reconnectBaseDelay = Duration(seconds: 1);
  17. static const reconnectMaxDelay = Duration(seconds: 30);
  18. static const appName = '检测数据采集';
  19. }