Skip to content

Commit

Permalink
refactor: update function return types to dynamic for better flexibility
Browse files Browse the repository at this point in the history
  • Loading branch information
tsutsu3 committed Jan 25, 2025
1 parent 55695a5 commit 5f90a97
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,10 @@ linter:
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
analyzer:
# language:
# strict-casts: true
# strict-inference: true
# strict-raw-types: true
language:
# strict-casts: true
# strict-inference: true
strict-raw-types: true

errors:
invalid_annotation_target: ignore
Expand Down
2 changes: 1 addition & 1 deletion lib/functions/refresh_server_status.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:pi_hole_client/providers/servers_provider.dart';
import 'package:pi_hole_client/providers/status_provider.dart';
import 'package:provider/provider.dart';

Future refreshServerStatus(BuildContext context) async {
Future<dynamic> refreshServerStatus(BuildContext context) async {

Check warning on line 13 in lib/functions/refresh_server_status.dart

View check run for this annotation

Codecov / codecov/patch

lib/functions/refresh_server_status.dart#L13

Added line #L13 was not covered by tests
final statusProvider = Provider.of<StatusProvider>(context, listen: false);
final serversProvider = Provider.of<ServersProvider>(context, listen: false);
final appConfigProvider =
Expand Down
2 changes: 1 addition & 1 deletion lib/models/log.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Log {
this.answeredBy,
});

factory Log.fromJson(List data) => Log(
factory Log.fromJson(List<dynamic> data) => Log(
dateTime:
DateTime.fromMillisecondsSinceEpoch((int.parse(data[0])) * 1000),
type: data[1],
Expand Down
2 changes: 1 addition & 1 deletion lib/providers/domains_list_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class DomainsListProvider with ChangeNotifier {
notifyListeners();
}

Future fetchDomainsList(Server server) async {
Future<dynamic> fetchDomainsList(Server server) async {
final apiGateway = serversProvider?.selectedApiGateway;
final result = await apiGateway?.getDomainLists();
if (result?.result == APiResponseType.success) {
Expand Down
2 changes: 1 addition & 1 deletion lib/providers/servers_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class ServersProvider with ChangeNotifier {
}
}

Future saveFromDb(List<ServerDbData>? servers) async {
Future<dynamic> saveFromDb(List<ServerDbData>? servers) async {
if (servers != null) {
Server? defaultServer;
for (final server in servers) {
Expand Down
2 changes: 1 addition & 1 deletion lib/repository/database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ class DatabaseRepository {
}

// Migration methods
Future _upgradeToV2(Database db) async {
Future<dynamic> _upgradeToV2(Database db) async {

Check warning on line 516 in lib/repository/database.dart

View check run for this annotation

Codecov / codecov/patch

lib/repository/database.dart#L516

Added line #L516 was not covered by tests
// await db.execute('ALTER TABLE appConfig DROP COLUMN oneColumnLegend');

// 1. Create a new table
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/home/home_appbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class HomeAppBar extends StatelessWidget implements PreferredSizeWidget {
}

Future<void> connectToServer(Server server) async {
Future connectSuccess(result) async {
Future<dynamic> connectSuccess(result) async {

Check warning on line 70 in lib/screens/home/home_appbar.dart

View check run for this annotation

Codecov / codecov/patch

lib/screens/home/home_appbar.dart#L69-L70

Added lines #L69 - L70 were not covered by tests
serversProvider.setselectedServer(
server: Server(
address: server.address,
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/logs/logs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class _LogsState extends State<Logs> {
DateTime? masterStartTime;
DateTime? masterEndTime;

Future loadLogs({
Future<dynamic> loadLogs({
required bool replaceOldLogs,
List<int>? statusSelected,
DateTime? inStartTime,
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/servers/servers_tile_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class _ServersTileItemState extends State<ServersTileItem>

/// Connect to the server button
Future<void> connectToServer(Server server) async {
Future connectSuccess(result) async {
Future<dynamic> connectSuccess(result) async {

Check warning on line 99 in lib/screens/servers/servers_tile_item.dart

View check run for this annotation

Codecov / codecov/patch

lib/screens/servers/servers_tile_item.dart#L98-L99

Added lines #L98 - L99 were not covered by tests
serversProvider.setselectedServer(
server: Server(
address: server.address,
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/scan_token_modal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class _ScanTokenModalState extends State<ScanTokenModal> {
final GlobalKey qrKey = GlobalKey(debugLabel: 'QR');
int permission = 0;

Future managePermission() async {
Future<dynamic> managePermission() async {

Check warning on line 21 in lib/widgets/scan_token_modal.dart

View check run for this annotation

Codecov / codecov/patch

lib/widgets/scan_token_modal.dart#L21

Added line #L21 was not covered by tests
if (await Permission.camera.isGranted) {
setState(() {
permission = 1;
Expand Down

0 comments on commit 5f90a97

Please sign in to comment.