From 573d78241f8ab878d4f25f30857f4a248428f902 Mon Sep 17 00:00:00 2001 From: Jigar-f Date: Mon, 27 May 2024 16:33:56 +0530 Subject: [PATCH] Optimize import. --- lib/account/device_linking/approve_device.dart | 1 + lib/account/settings.dart | 5 +---- lib/account/support.dart | 1 + lib/catcher_setup.dart | 1 + lib/common/common.dart | 6 ++---- lib/common/common_desktop.dart | 12 ++---------- lib/common/ffi_list_subscriber.dart | 4 ---- lib/common/ffi_subscriber.dart | 6 ++---- lib/common/model.dart | 4 ++-- lib/common/tray_handler.dart | 2 -- lib/common/ui/app_webview.dart | 1 - lib/common/ui/custom/text.dart | 2 -- lib/common/ui/websocket.dart | 3 +-- lib/core/router/router.dart | 3 --- lib/i18n/i18n.dart | 2 +- lib/messaging/messaging_model.dart | 3 ++- .../protos_flutteronly/messaging.pbenum.dart | 1 + .../protos_flutteronly/messaging.pbjson.dart | 2 +- lib/plans/plan_details.dart | 1 - lib/plans/reseller_checkout.dart | 2 +- lib/plans/utils.dart | 1 - lib/replica/logic/uploader.dart | 2 +- lib/vpn/vpn_model.dart | 2 +- lib/vpn/vpn_status.dart | 1 - lib/vpn/vpn_tab.dart | 1 + 25 files changed, 22 insertions(+), 47 deletions(-) diff --git a/lib/account/device_linking/approve_device.dart b/lib/account/device_linking/approve_device.dart index 4bd7fe4a0..9411c03da 100644 --- a/lib/account/device_linking/approve_device.dart +++ b/lib/account/device_linking/approve_device.dart @@ -1,5 +1,6 @@ import 'package:lantern/common/common.dart'; import 'package:lantern/plans/utils.dart'; + import 'explanation_step.dart'; @RoutePage(name: 'ApproveDevice') diff --git a/lib/account/settings.dart b/lib/account/settings.dart index 4736bc04c..1cdead378 100644 --- a/lib/account/settings.dart +++ b/lib/account/settings.dart @@ -1,15 +1,12 @@ -import 'package:catcher_2/core/catcher_2.dart'; +import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:intl/intl.dart'; import 'package:lantern/common/app_methods.dart'; -import 'package:lantern/common/app_secret.dart'; import 'package:lantern/common/common.dart'; import 'package:lantern/common/common_desktop.dart'; import 'package:lantern/common/ui/app_loading_dialog.dart'; import 'package:lantern/i18n/localization_constants.dart'; import 'package:lantern/messaging/messaging_model.dart'; import 'package:package_info_plus/package_info_plus.dart'; -import 'package:sentry_flutter/sentry_flutter.dart'; -import 'package:flutter_inappwebview/flutter_inappwebview.dart'; @RoutePage(name: 'Settings') class Settings extends StatelessWidget { diff --git a/lib/account/support.dart b/lib/account/support.dart index 022ab72e6..d66eb1afa 100644 --- a/lib/account/support.dart +++ b/lib/account/support.dart @@ -1,4 +1,5 @@ import 'package:url_launcher/url_launcher.dart'; + import '../common/common.dart'; @RoutePage(name: 'Support') diff --git a/lib/catcher_setup.dart b/lib/catcher_setup.dart index ad89850ea..f3c6cbfae 100644 --- a/lib/catcher_setup.dart +++ b/lib/catcher_setup.dart @@ -1,4 +1,5 @@ import 'dart:io'; + import 'package:catcher_2/catcher_2.dart'; import 'package:flutter/material.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; diff --git a/lib/common/common.dart b/lib/common/common.dart index 154be3e54..71883d4d7 100644 --- a/lib/common/common.dart +++ b/lib/common/common.dart @@ -33,6 +33,7 @@ export 'package:stop_watch_timer/stop_watch_timer.dart'; export 'add_nonbreaking_spaces.dart'; export 'app_keys.dart'; +export 'app_secret.dart'; export 'disable_back_button.dart'; export 'iterable_extension.dart'; export 'list_subscriber.dart'; @@ -51,7 +52,6 @@ export 'ui/continue_arrow.dart'; export 'ui/copy_text.dart'; export 'ui/countdown_min_sec.dart'; export 'ui/countdown_stopwatch.dart'; - // custom components export 'ui/custom/asset_image.dart'; export 'ui/custom/badge.dart'; @@ -62,10 +62,10 @@ export 'ui/custom/fullscreen_video_viewer.dart'; export 'ui/custom/fullscreen_viewer.dart'; export 'ui/custom/ink_well.dart'; export 'ui/custom/list_item_factory.dart'; +export 'ui/custom/retry_widget.dart'; export 'ui/custom/rounded_rectangle_border.dart'; export 'ui/custom/text.dart'; export 'ui/custom/text_field.dart'; -export 'ui/custom/retry_widget.dart'; export 'ui/dimens.dart'; export 'ui/focused_menu.dart'; export 'ui/full_screen_dialog.dart'; @@ -87,11 +87,9 @@ export 'ui/round_button.dart'; export 'ui/search_field.dart'; export 'ui/show_bottom_modal.dart'; export 'ui/show_snackbar.dart'; - export 'ui/text_highlighter.dart'; export 'ui/text_styles.dart'; export 'ui/transitions.dart'; -export 'app_secret.dart'; final appLogger = Logger( printer: PrettyPrinter( diff --git a/lib/common/common_desktop.dart b/lib/common/common_desktop.dart index e8c95fad7..cef3aa28b 100644 --- a/lib/common/common_desktop.dart +++ b/lib/common/common_desktop.dart @@ -1,18 +1,10 @@ -import 'package:lantern/common/common.dart'; -import 'package:tray_manager/tray_manager.dart'; -import 'package:lantern/ffi.dart'; -import 'package:ffi/ffi.dart'; -import 'dart:ffi'; -import 'package:lantern/common/ui/websocket.dart'; -import 'package:web_socket_channel/io.dart'; -import 'package:web_socket_channel/web_socket_channel.dart'; - export 'dart:convert'; export 'dart:ffi'; // For FFI + export 'package:ffi/ffi.dart'; export 'package:ffi/src/utf8.dart'; -export 'package:lantern/ffi.dart'; export 'package:lantern/common/tray_handler.dart'; export 'package:lantern/common/ui/websocket.dart'; +export 'package:lantern/ffi.dart'; export 'package:web_socket_channel/io.dart'; export 'package:web_socket_channel/web_socket_channel.dart'; diff --git a/lib/common/ffi_list_subscriber.dart b/lib/common/ffi_list_subscriber.dart index 0de3db544..36d290ced 100644 --- a/lib/common/ffi_list_subscriber.dart +++ b/lib/common/ffi_list_subscriber.dart @@ -2,10 +2,6 @@ import 'dart:collection'; import 'common.dart'; import 'common_desktop.dart'; -import 'list_subscriber.dart'; -import 'package:lantern/i18n/i18n.dart'; -import 'package:fixnum/fixnum.dart'; -import 'package:intl/intl.dart'; class FfiListNotifier extends SubscribedNotifier> { FfiListNotifier( diff --git a/lib/common/ffi_subscriber.dart b/lib/common/ffi_subscriber.dart index c50743d45..26271b42f 100644 --- a/lib/common/ffi_subscriber.dart +++ b/lib/common/ffi_subscriber.dart @@ -1,9 +1,7 @@ +import 'package:web_socket_channel/status.dart' as status; + import 'common.dart'; import 'common_desktop.dart'; -import 'dart:convert'; -import 'package:web_socket_channel/io.dart'; -import 'package:web_socket_channel/status.dart' as status; -import 'package:web_socket_channel/web_socket_channel.dart'; extension BoolParsing on String { bool parseBool() { diff --git a/lib/common/model.dart b/lib/common/model.dart index 504841ae1..0472643b6 100644 --- a/lib/common/model.dart +++ b/lib/common/model.dart @@ -1,10 +1,10 @@ import 'dart:collection'; -import 'package:lantern/common/ffi_subscriber.dart'; import 'package:lantern/common/ffi_list_subscriber.dart'; +import 'package:lantern/common/ffi_subscriber.dart'; import 'package:lantern/messaging/messaging.dart'; + import 'common_desktop.dart'; -import 'package:web_socket_channel/web_socket_channel.dart'; abstract class Model { late MethodChannel methodChannel; diff --git a/lib/common/tray_handler.dart b/lib/common/tray_handler.dart index 19d8b68dd..84825e2d6 100644 --- a/lib/common/tray_handler.dart +++ b/lib/common/tray_handler.dart @@ -1,5 +1,3 @@ -import 'dart:ui'; - import 'package:lantern/common/common.dart'; import 'package:lantern/common/common_desktop.dart'; import 'package:tray_manager/tray_manager.dart'; diff --git a/lib/common/ui/app_webview.dart b/lib/common/ui/app_webview.dart index 9b9cefc5c..df88cf6f2 100644 --- a/lib/common/ui/app_webview.dart +++ b/lib/common/ui/app_webview.dart @@ -1,7 +1,6 @@ import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:flutter_windows_webview/flutter_windows_webview.dart'; import 'package:lantern/common/common.dart'; -import 'package:lantern/common/ui/app_loading_dialog.dart'; @RoutePage(name: 'AppWebview') class AppWebView extends StatefulWidget { diff --git a/lib/common/ui/custom/text.dart b/lib/common/ui/custom/text.dart index eabe25901..23107fbea 100644 --- a/lib/common/ui/custom/text.dart +++ b/lib/common/ui/custom/text.dart @@ -1,5 +1,3 @@ -import 'dart:ui'; - import 'package:lantern/common/common.dart'; class CText extends StatelessWidget { diff --git a/lib/common/ui/websocket.dart b/lib/common/ui/websocket.dart index 0be4e530b..116b7a0f5 100644 --- a/lib/common/ui/websocket.dart +++ b/lib/common/ui/websocket.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'dart:convert'; -import 'package:flutter/foundation.dart'; + import 'package:lantern/common/common_desktop.dart'; abstract class WebsocketService { diff --git a/lib/core/router/router.dart b/lib/core/router/router.dart index 56039368c..02d265aac 100644 --- a/lib/core/router/router.dart +++ b/lib/core/router/router.dart @@ -1,7 +1,4 @@ -import 'package:auto_route/auto_route.dart'; import 'package:lantern/common/common.dart'; -import 'package:lantern/common/ui/transitions.dart'; -import 'package:lantern/core/router/router.gr.dart'; @AutoRouterConfig( replaceInRouteName: 'Page,Route,Screen', diff --git a/lib/i18n/i18n.dart b/lib/i18n/i18n.dart index 3ae2e7b98..a24578b83 100644 --- a/lib/i18n/i18n.dart +++ b/lib/i18n/i18n.dart @@ -1,5 +1,5 @@ -import 'package:i18n_extension_importer/src/io/import.dart'; import 'package:i18n_extension/i18n_extension.dart'; +import 'package:i18n_extension_importer/src/io/import.dart'; import 'package:lantern/common/common.dart'; extension Localization on String { diff --git a/lib/messaging/messaging_model.dart b/lib/messaging/messaging_model.dart index c16236b58..b9e97ba65 100644 --- a/lib/messaging/messaging_model.dart +++ b/lib/messaging/messaging_model.dart @@ -1,7 +1,8 @@ // import 'calls/signaling.dart'; -import 'messaging.dart'; import 'package:lantern/common/common_desktop.dart'; +import 'messaging.dart'; + final messagingModel = MessagingModel(); class MessagingModel extends Model { diff --git a/lib/messaging/protos_flutteronly/messaging.pbenum.dart b/lib/messaging/protos_flutteronly/messaging.pbenum.dart index 2941f5be8..9b52e6f35 100644 --- a/lib/messaging/protos_flutteronly/messaging.pbenum.dart +++ b/lib/messaging/protos_flutteronly/messaging.pbenum.dart @@ -7,6 +7,7 @@ // ignore_for_file: UNDEFINED_SHOWN_NAME import 'dart:core' as $core; + import 'package:protobuf/protobuf.dart' as $pb; class MessageDirection extends $pb.ProtobufEnum { diff --git a/lib/messaging/protos_flutteronly/messaging.pbjson.dart b/lib/messaging/protos_flutteronly/messaging.pbjson.dart index 7a83913f0..3e5ead132 100644 --- a/lib/messaging/protos_flutteronly/messaging.pbjson.dart +++ b/lib/messaging/protos_flutteronly/messaging.pbjson.dart @@ -1,4 +1,5 @@ /// +import 'dart:convert' as $convert; // Generated code. Do not modify. // source: protos_flutteronly/messaging.proto // @@ -6,7 +7,6 @@ // ignore_for_file: annotate_overrides,camel_case_types,constant_identifier_names,deprecated_member_use_from_same_package,directives_ordering,library_prefixes,non_constant_identifier_names,prefer_final_fields,return_of_invalid_type,unnecessary_const,unnecessary_import,unnecessary_this,unused_import,unused_shown_name import 'dart:core' as $core; -import 'dart:convert' as $convert; import 'dart:typed_data' as $typed_data; @$core.Deprecated('Use messageDirectionDescriptor instead') const MessageDirection$json = const { diff --git a/lib/plans/plan_details.dart b/lib/plans/plan_details.dart index 7f0793b0d..c4077bbed 100644 --- a/lib/plans/plan_details.dart +++ b/lib/plans/plan_details.dart @@ -1,5 +1,4 @@ import 'package:lantern/common/common.dart'; -import 'package:lantern/plans/payment_provider.dart'; import 'package:lantern/plans/utils.dart'; class PlanCard extends StatelessWidget { diff --git a/lib/plans/reseller_checkout.dart b/lib/plans/reseller_checkout.dart index 4d3c77eb2..60f3e4a02 100644 --- a/lib/plans/reseller_checkout.dart +++ b/lib/plans/reseller_checkout.dart @@ -1,9 +1,9 @@ import 'package:email_validator/email_validator.dart'; +import 'package:intl/intl.dart'; import 'package:lantern/common/common.dart'; import 'package:lantern/plans/plan_details.dart'; import 'package:lantern/plans/tos.dart'; import 'package:lantern/plans/utils.dart'; -import 'package:intl/intl.dart'; class ResellerCodeFormatter extends TextInputFormatter { @override diff --git a/lib/plans/utils.dart b/lib/plans/utils.dart index e53b33888..b8a5bfe40 100644 --- a/lib/plans/utils.dart +++ b/lib/plans/utils.dart @@ -1,7 +1,6 @@ import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:lantern/common/common.dart'; import 'package:lantern/common/ui/app_webview.dart'; -import 'package:lantern/plans/payment_provider.dart'; const defaultTimeoutDuration = Duration(seconds: 10); diff --git a/lib/replica/logic/uploader.dart b/lib/replica/logic/uploader.dart index 43d4d961f..7196824c5 100644 --- a/lib/replica/logic/uploader.dart +++ b/lib/replica/logic/uploader.dart @@ -1,7 +1,7 @@ import 'package:flutter_uploader/flutter_uploader.dart'; +import 'package:http/http.dart' as http; import 'package:lantern/common/common.dart'; import 'package:lantern/messaging/notifications.dart'; -import 'package:http/http.dart' as http; /// ReplicaUploader is a singleton class. Use it like this: /// - Initialize ReplicaUploader by calling ReplicaUploader.inst.init() diff --git a/lib/vpn/vpn_model.dart b/lib/vpn/vpn_model.dart index c5698b42a..88f8547d2 100644 --- a/lib/vpn/vpn_model.dart +++ b/lib/vpn/vpn_model.dart @@ -1,5 +1,5 @@ -import 'package:lantern/vpn/vpn.dart'; import 'package:lantern/common/common_desktop.dart'; +import 'package:lantern/vpn/vpn.dart'; final vpnModel = VpnModel(); diff --git a/lib/vpn/vpn_status.dart b/lib/vpn/vpn_status.dart index c39987978..5f843fe37 100644 --- a/lib/vpn/vpn_status.dart +++ b/lib/vpn/vpn_status.dart @@ -1,5 +1,4 @@ import 'package:lantern/vpn/vpn.dart'; -import 'package:lantern/common/common_desktop.dart'; class VPNStatus extends StatelessWidget { @override diff --git a/lib/vpn/vpn_tab.dart b/lib/vpn/vpn_tab.dart index 407e2a2f4..435222e93 100644 --- a/lib/vpn/vpn_tab.dart +++ b/lib/vpn/vpn_tab.dart @@ -1,6 +1,7 @@ import 'package:lantern/account/split_tunneling.dart'; import 'package:lantern/messaging/messaging.dart'; import 'package:lantern/vpn/vpn.dart'; + import 'vpn_bandwidth.dart'; import 'vpn_pro_banner.dart'; import 'vpn_server_location.dart';