2023-01-11 19:17:04 -05:00
|
|
|
import 'dart:async';
|
|
|
|
|
|
|
|
import 'package:flutter/foundation.dart';
|
2023-01-07 21:43:31 -05:00
|
|
|
import 'package:flutter/material.dart';
|
2023-01-08 22:27:33 -05:00
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
2023-01-11 19:17:04 -05:00
|
|
|
import 'log/log.dart';
|
|
|
|
import 'veilid_support/veilid_support.dart';
|
|
|
|
import 'theming/theming.dart';
|
2023-01-08 22:27:33 -05:00
|
|
|
import 'app.dart';
|
2023-01-11 19:17:04 -05:00
|
|
|
import 'dart:io';
|
2023-01-08 22:27:33 -05:00
|
|
|
|
|
|
|
void main() async {
|
2023-01-11 19:17:04 -05:00
|
|
|
// Disable all debugprints in release mode
|
|
|
|
if (kReleaseMode) {
|
|
|
|
debugPrint = (String? message, {int? wrapWidth}) {};
|
|
|
|
}
|
|
|
|
|
|
|
|
// Print our PID for debugging
|
|
|
|
if (!kIsWeb) {
|
|
|
|
debugPrint('VeilidChat PID: $pid');
|
|
|
|
}
|
|
|
|
|
2023-01-08 22:27:33 -05:00
|
|
|
// Logs
|
|
|
|
initLoggy();
|
|
|
|
|
2023-01-11 19:17:04 -05:00
|
|
|
// Prepare theme
|
2023-01-08 22:27:33 -05:00
|
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
final themeService = await ThemeService.instance;
|
|
|
|
var initTheme = themeService.initial;
|
2023-01-11 19:17:04 -05:00
|
|
|
|
|
|
|
// Start up Veilid and Veilid processor in the background
|
|
|
|
unawaited(initializeVeilid());
|
|
|
|
|
|
|
|
// Run the app
|
|
|
|
// Hot reloads will only restart this part, not Veilid
|
2023-01-08 22:27:33 -05:00
|
|
|
runApp(
|
|
|
|
ProviderScope(
|
2023-01-09 22:50:34 -05:00
|
|
|
observers: const [StateLogger()],
|
2023-01-08 22:27:33 -05:00
|
|
|
child: VeilidChatApp(theme: initTheme)),
|
|
|
|
);
|
2023-01-07 21:43:31 -05:00
|
|
|
}
|