Browse Source

feat(app,dynamite,neon,neon_files,neon_news,neon_notes,neon_notifications,neon_lints,nextcloud): enable strict-raw-types

Signed-off-by: Nikolas Rimikis <leptopoda@users.noreply.github.com>
pull/742/head
Nikolas Rimikis 1 year ago
parent
commit
5056f43f1d
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 10
      packages/app/integration_test/screenshot_test.dart
  2. 2
      packages/app/lib/main.dart
  3. 2
      packages/dynamite/dynamite/lib/src/builder/client.dart
  4. 2
      packages/neon/neon/lib/neon.dart
  5. 12
      packages/neon/neon/lib/src/app.dart
  6. 6
      packages/neon/neon/lib/src/bloc/bloc.dart
  7. 10
      packages/neon/neon/lib/src/blocs/apps.dart
  8. 2
      packages/neon/neon/lib/src/blocs/capabilities.dart
  9. 4
      packages/neon/neon/lib/src/blocs/first_launch.dart
  10. 2
      packages/neon/neon/lib/src/blocs/login_check_account.dart
  11. 2
      packages/neon/neon/lib/src/blocs/login_check_server_status.dart
  12. 2
      packages/neon/neon/lib/src/blocs/login_flow.dart
  13. 4
      packages/neon/neon/lib/src/blocs/next_push.dart
  14. 8
      packages/neon/neon/lib/src/blocs/push_notifications.dart
  15. 8
      packages/neon/neon/lib/src/blocs/unified_search.dart
  16. 2
      packages/neon/neon/lib/src/blocs/user_details.dart
  17. 4
      packages/neon/neon/lib/src/blocs/user_statuses.dart
  18. 2
      packages/neon/neon/lib/src/models/app_implementation.dart
  19. 6
      packages/neon/neon/lib/src/pages/home.dart
  20. 2
      packages/neon/neon/lib/src/pages/route_not_found.dart
  21. 4
      packages/neon/neon/lib/src/platform/platform.dart
  22. 2
      packages/neon/neon/lib/src/router.dart
  23. 4
      packages/neon/neon/lib/src/settings/models/options_collection.dart
  24. 18
      packages/neon/neon/lib/src/settings/models/storage.dart
  25. 2
      packages/neon/neon/lib/src/settings/widgets/settings_tile.dart
  26. 2
      packages/neon/neon/lib/src/utils/account_options.dart
  27. 4
      packages/neon/neon/lib/src/utils/global_options.dart
  28. 2
      packages/neon/neon/lib/src/utils/global_popups.dart
  29. 2
      packages/neon/neon/lib/src/utils/push_utils.dart
  30. 12
      packages/neon/neon/lib/src/utils/request_manager.dart
  31. 4
      packages/neon/neon/lib/src/widgets/app_bar.dart
  32. 2
      packages/neon/neon/lib/src/widgets/list_view.dart
  33. 4
      packages/neon/neon/test/option_test.dart
  34. 4
      packages/neon/neon/test/options_collection_test.dart
  35. 2
      packages/neon/neon_files/lib/blocs/browser.dart
  36. 4
      packages/neon/neon_files/lib/blocs/files.dart
  37. 4
      packages/neon/neon_files/lib/dialogs/choose_create.dart
  38. 2
      packages/neon/neon_files/lib/neon_files.dart
  39. 4
      packages/neon/neon_files/lib/utils/task.dart
  40. 4
      packages/neon/neon_news/lib/blocs/article.dart
  41. 4
      packages/neon/neon_news/lib/blocs/articles.dart
  42. 4
      packages/neon/neon_news/lib/blocs/news.dart
  43. 2
      packages/neon/neon_news/lib/neon_news.dart
  44. 2
      packages/neon/neon_news/lib/pages/article.dart
  45. 2
      packages/neon/neon_notes/lib/blocs/note.dart
  46. 4
      packages/neon/neon_notes/lib/blocs/notes.dart
  47. 2
      packages/neon/neon_notes/lib/neon_notes.dart
  48. 2
      packages/neon/neon_notifications/lib/blocs/notifications.dart
  49. 2
      packages/neon/neon_notifications/lib/neon_notifications.dart
  50. 1
      packages/neon_lints/lib/src/base.yaml
  51. 1
      packages/neon_lints/lint_maker.yaml
  52. 22
      packages/nextcloud/lib/src/api/news.openapi.dart
  53. 2
      packages/nextcloud/lib/src/webdav/client.dart
  54. 2
      packages/nextcloud/test/helper.dart
  55. 2
      packages/nextcloud/test/notifications_test.dart
  56. 4
      packages/nextcloud/test/settings_test.dart
  57. 2
      packages/sort_box/lib/sort_box.dart

10
packages/app/integration_test/screenshot_test.dart

@ -14,7 +14,7 @@ import 'package:neon/settings.dart';
import 'package:neon_files/widgets/actions.dart';
import 'package:shared_preferences/shared_preferences.dart';
Future runTestApp(
Future<void> runTestApp(
final WidgetTester tester,
final IntegrationTestWidgetsFlutterBinding binding, {
final Account? account,
@ -30,18 +30,18 @@ Future runTestApp(
await tester.pumpAndSettle();
}
Future openDrawer(final WidgetTester tester) async {
Future<void> openDrawer(final WidgetTester tester) async {
await tester.tap(find.byTooltip('Open navigation menu'));
await tester.pumpAndSettle();
}
Future switchPage(final WidgetTester tester, final String name) async {
Future<void> switchPage(final WidgetTester tester, final String name) async {
await openDrawer(tester);
await tester.tap(find.text(name).last);
await tester.pumpAndSettle();
}
Future prepareScreenshot(final WidgetTester tester, final IntegrationTestWidgetsFlutterBinding binding) async {
Future<void> prepareScreenshot(final WidgetTester tester, final IntegrationTestWidgetsFlutterBinding binding) async {
await binding.convertFlutterSurfaceToImage();
await tester.pumpAndSettle();
}
@ -63,7 +63,7 @@ Future<Account> getAccount(final String username) async {
);
}
Future main() async {
Future<void> main() async {
// The screenshots are pretty annoying on Android. See https://github.com/flutter/flutter/issues/92381
assert(Platform.isAndroid, 'Screenshots need to be taken on Android');

2
packages/app/lib/main.dart

@ -2,7 +2,7 @@ import 'package:app/apps.dart';
import 'package:app/branding.dart';
import 'package:neon/neon.dart';
Future main() async {
Future<void> main() async {
await runNeon(
appImplementations: appImplementations,
theme: neonTheme,

2
packages/dynamite/dynamite/lib/src/builder/client.dart

@ -604,7 +604,7 @@ final _response = await ${isRootClient ? 'this' : '_rootClient'}.doRequest(
b.returns = refer('Future<$dataType>');
code.write('return $dataValue;');
} else {
b.returns = refer('Future');
b.returns = refer('Future<void>');
code.write('return;');
}

2
packages/neon/neon/lib/neon.dart

@ -18,7 +18,7 @@ import 'package:neon/src/utils/user_agent.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:provider/provider.dart';
Future runNeon({
Future<void> runNeon({
required final Iterable<AppImplementation> appImplementations,
required final NeonTheme theme,
@visibleForTesting final WidgetsBinding? bindingOverride,

12
packages/neon/neon/lib/src/app.dart

@ -196,7 +196,7 @@ class _NeonAppState extends State<NeonApp> with WidgetsBindingObserver, tray.Tra
}
@override
Future onWindowClose() async {
Future<void> onWindowClose() async {
if (_globalOptions.startupMinimizeInsteadOfExit.value) {
await _saveAndMinimizeWindow();
} else {
@ -205,11 +205,11 @@ class _NeonAppState extends State<NeonApp> with WidgetsBindingObserver, tray.Tra
}
@override
Future onWindowMinimize() async {
Future<void> onWindowMinimize() async {
await _saveAndMinimizeWindow();
}
Future _handleShortcut(final String shortcutType) async {
Future<void> _handleShortcut(final String shortcutType) async {
if (shortcutType == 'show_hide') {
if (NeonPlatform.instance.canUseWindowManager) {
if (await windowManager.isVisible()) {
@ -231,13 +231,13 @@ class _NeonAppState extends State<NeonApp> with WidgetsBindingObserver, tray.Tra
}
}
Future _openAppFromExternal(final Account account, final String id) async {
Future<void> _openAppFromExternal(final Account account, final String id) async {
await _accountsBloc.getAppsBlocFor(account).setActiveApp(id);
_navigatorKey.currentState!.popUntil((final route) => route.settings.name == 'home');
await _showAndRestoreWindow();
}
Future _saveAndMinimizeWindow() async {
Future<void> _saveAndMinimizeWindow() async {
_lastBounds = await windowManager.getBounds();
if (_globalOptions.systemTrayEnabled.value && _globalOptions.systemTrayHideToTrayWhenMinimized.value) {
await windowManager.hide();
@ -246,7 +246,7 @@ class _NeonAppState extends State<NeonApp> with WidgetsBindingObserver, tray.Tra
}
}
Future _showAndRestoreWindow() async {
Future<void> _showAndRestoreWindow() async {
if (!NeonPlatform.instance.canUseWindowManager) {
return;
}

6
packages/neon/neon/lib/src/bloc/bloc.dart

@ -17,7 +17,7 @@ abstract class InteractiveBloc extends Bloc {
final _errorsStreamController = StreamController<Object>();
late Stream<Object> errors = _errorsStreamController.stream.asBroadcastStream();
Future refresh();
Future<void> refresh();
void addError(final Object error) {
_errorsStreamController.add(error);
@ -25,9 +25,9 @@ abstract class InteractiveBloc extends Bloc {
// ignore: avoid_void_async
void wrapAction(
final Future Function() call, {
final Future<void> Function() call, {
final bool disableTimeout = false,
final Future Function()? refresh,
final Future<void> Function()? refresh,
}) async {
try {
if (disableTimeout) {

10
packages/neon/neon/lib/src/blocs/apps.dart

@ -33,7 +33,7 @@ abstract class AppsBlocStates {
BehaviorSubject<AppImplementation> get activeApp;
BehaviorSubject get openNotifications;
BehaviorSubject<void> get openNotifications;
BehaviorSubject<Iterable<(String, Object?)>?> get appVersions;
}
@ -182,13 +182,13 @@ class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates
BehaviorSubject<Result<NotificationsAppInterface?>>();
@override
BehaviorSubject openNotifications = BehaviorSubject();
BehaviorSubject<void> openNotifications = BehaviorSubject();
@override
BehaviorSubject<List<(String, Object?)>?> appVersions = BehaviorSubject();
@override
Future refresh() async {
Future<void> refresh() async {
await RequestManager.instance
.wrapNextcloud<List<CoreNavigationEntry>, CoreNavigationGetAppsNavigationResponseApplicationJson>(
_account.id,
@ -200,7 +200,7 @@ class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates
}
@override
Future setActiveApp(final String appID, {final bool skipAlreadySet = false}) async {
Future<void> setActiveApp(final String appID, {final bool skipAlreadySet = false}) async {
if (appID == AppIDs.notifications) {
openNotifications.add(null);
return;
@ -220,6 +220,6 @@ class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates
T getAppBloc<T extends Bloc>(final AppImplementation<T, dynamic> appImplementation) =>
appImplementation.getBloc(_account);
List<Provider> get appBlocProviders =>
List<Provider<Bloc>> get appBlocProviders =>
_allAppImplementations.map((final appImplementation) => appImplementation.blocProvider).toList();
}

2
packages/neon/neon/lib/src/blocs/capabilities.dart

@ -35,7 +35,7 @@ class CapabilitiesBloc extends InteractiveBloc implements CapabilitiesBlocEvents
BehaviorSubject<Result<CoreOcsGetCapabilitiesResponseApplicationJson_Ocs_Data>>();
@override
Future refresh() async {
Future<void> refresh() async {
await RequestManager.instance.wrapNextcloud<CoreOcsGetCapabilitiesResponseApplicationJson_Ocs_Data,
CoreOcsGetCapabilitiesResponseApplicationJson>(
_account.id,

4
packages/neon/neon/lib/src/blocs/first_launch.dart

@ -8,7 +8,7 @@ import 'package:rxdart/rxdart.dart';
abstract class FirstLaunchBlocEvents {}
abstract class FirstLaunchBlocStates {
BehaviorSubject get onFirstLaunch;
BehaviorSubject<void> get onFirstLaunch;
}
@immutable
@ -31,5 +31,5 @@ class FirstLaunchBloc extends Bloc implements FirstLaunchBlocEvents, FirstLaunch
}
@override
final BehaviorSubject onFirstLaunch = BehaviorSubject();
final BehaviorSubject<void> onFirstLaunch = BehaviorSubject();
}

2
packages/neon/neon/lib/src/blocs/login_check_account.dart

@ -40,7 +40,7 @@ class LoginCheckAccountBloc extends InteractiveBloc
BehaviorSubject<Result<Account>> state = BehaviorSubject();
@override
Future refresh() async {
Future<void> refresh() async {
state.add(Result.loading());
try {

2
packages/neon/neon/lib/src/blocs/login_check_server_status.dart

@ -33,7 +33,7 @@ class LoginCheckServerStatusBloc extends InteractiveBloc
BehaviorSubject<Result<CoreStatus>> state = BehaviorSubject();
@override
Future refresh() async {
Future<void> refresh() async {
state.add(Result.loading());
try {

2
packages/neon/neon/lib/src/blocs/login_flow.dart

@ -45,7 +45,7 @@ class LoginFlowBloc extends InteractiveBloc implements LoginFlowBlocEvents, Logi
late Stream<CoreLoginFlowV2Credentials> result = _resultController.stream.asBroadcastStream();
@override
Future refresh() async {
Future<void> refresh() async {
try {
init.add(Result.loading());

4
packages/neon/neon/lib/src/blocs/next_push.dart

@ -11,7 +11,7 @@ import 'package:rxdart/rxdart.dart';
abstract class NextPushBlocEvents {}
abstract class NextPushBlocStates {
BehaviorSubject get onNextPushSupported;
BehaviorSubject<void> get onNextPushSupported;
}
@internal
@ -78,5 +78,5 @@ class NextPushBloc extends Bloc implements NextPushBlocEvents, NextPushBlocState
}
@override
BehaviorSubject onNextPushSupported = BehaviorSubject();
BehaviorSubject<void> onNextPushSupported = BehaviorSubject();
}

8
packages/neon/neon/lib/src/blocs/push_notifications.dart

@ -40,7 +40,7 @@ class PushNotificationsBloc extends Bloc implements PushNotificationsBlocEvents,
final GlobalOptions _globalOptions;
final _notificationsController = StreamController<PushNotification>();
StreamSubscription? _accountsListener;
StreamSubscription<List<Account>>? _accountsListener;
@override
void dispose() {
@ -66,7 +66,7 @@ class PushNotificationsBloc extends Bloc implements PushNotificationsBlocEvents,
}
}
Future _setupUnifiedPush() async {
Future<void> _setupUnifiedPush() async {
// We just use a single RSA keypair for all accounts
final keypair = await PushUtils.loadRSAKeypair();
@ -118,7 +118,7 @@ class PushNotificationsBloc extends Bloc implements PushNotificationsBlocEvents,
}
}
Future _unregisterUnifiedPushInstances(final List<Account> accounts) async {
Future<void> _unregisterUnifiedPushInstances(final List<Account> accounts) async {
for (final account in accounts) {
try {
await account.client.notifications.push.removeDevice();
@ -130,7 +130,7 @@ class PushNotificationsBloc extends Bloc implements PushNotificationsBlocEvents,
}
}
Future _registerUnifiedPushInstances(final List<Account> accounts) async {
Future<void> _registerUnifiedPushInstances(final List<Account> accounts) async {
// Notifications will only work on accounts with app password
for (final account in accounts.where((final a) => a.password != null)) {
await UnifiedPush.registerApp(account.id);

8
packages/neon/neon/lib/src/blocs/unified_search.dart

@ -56,12 +56,12 @@ class UnifiedSearchBloc extends InteractiveBloc implements UnifiedSearchBlocEven
}
@override
Future refresh() async {
Future<void> refresh() async {
await _search();
}
@override
Future search(final String term) async {
Future<void> search(final String term) async {
_term = term.trim();
await _search();
}
@ -78,7 +78,7 @@ class UnifiedSearchBloc extends InteractiveBloc implements UnifiedSearchBlocEven
_term = '';
}
Future _search() async {
Future<void> _search() async {
if (_term.isEmpty) {
results.add(Result.success(null));
return;
@ -108,7 +108,7 @@ class UnifiedSearchBloc extends InteractiveBloc implements UnifiedSearchBlocEven
}
}
Future _searchProvider(final CoreUnifiedSearchProvider provider) async {
Future<void> _searchProvider(final CoreUnifiedSearchProvider provider) async {
_updateResults(provider, Result.loading());
try {
final response = await _account.client.core.unifiedSearch.search(

2
packages/neon/neon/lib/src/blocs/user_details.dart

@ -35,7 +35,7 @@ class UserDetailsBloc extends InteractiveBloc implements UserDetailsBlocEvents,
BehaviorSubject<Result<ProvisioningApiUserDetails>>();
@override
Future refresh() async {
Future<void> refresh() async {
await RequestManager.instance
.wrapNextcloud<ProvisioningApiUserDetails, ProvisioningApiUsersGetCurrentUserResponseApplicationJson>(
_account.id,

4
packages/neon/neon/lib/src/blocs/user_statuses.dart

@ -43,14 +43,14 @@ class UserStatusesBloc extends InteractiveBloc implements UserStatusesBlocEvents
BehaviorSubject<Map<String, Result<UserStatusPublicInterface?>>>();
@override
Future refresh() async {
Future<void> refresh() async {
for (final username in _statuses.keys) {
await load(username, force: true);
}
}
@override
Future load(final String username, {final bool force = false}) async {
Future<void> load(final String username, {final bool force = false}) async {
if (!force && _statuses.containsKey(username)) {
return;
}

2
packages/neon/neon/lib/src/models/app_implementation.dart

@ -18,7 +18,7 @@ abstract class AppImplementation<T extends Bloc, R extends NextcloudAppOptions>
AppImplementation();
String get id;
LocalizationsDelegate get localizationsDelegate;
LocalizationsDelegate<Object> get localizationsDelegate;
List<Locale> get supportedLocales;
String nameFromLocalization(final AppLocalizations localizations) => localizations.appImplementationName(id);

6
packages/neon/neon/lib/src/pages/home.dart

@ -32,7 +32,7 @@ class _HomePageState extends State<HomePage> {
late GlobalOptions _globalOptions;
late AccountsBloc _accountsBloc;
late AppsBloc _appsBloc;
late StreamSubscription _versionCheckSubscription;
late StreamSubscription<List<(String, Object?)>?> _versionCheckSubscription;
@override
void initState() {
@ -76,7 +76,7 @@ class _HomePageState extends State<HomePage> {
super.dispose();
}
Future _checkMaintenanceMode() async {
Future<void> _checkMaintenanceMode() async {
try {
final status = await _account.client.core.getStatus();
if (status.maintenance && mounted) {
@ -93,7 +93,7 @@ class _HomePageState extends State<HomePage> {
}
}
Future _showProblem(final String title) async {
Future<void> _showProblem(final String title) async {
final colorScheme = Theme.of(context).colorScheme;
await showDialog(

2
packages/neon/neon/lib/src/pages/route_not_found.dart

@ -27,7 +27,7 @@ class _RouteNotFoundPageState extends State<RouteNotFoundPage> {
unawaited(_checkLaunchable());
}
Future _checkLaunchable() async {
Future<void> _checkLaunchable() async {
final accountsBloc = Provider.of<AccountsBloc>(context, listen: false);
if (!accountsBloc.hasAccounts) {
return;

4
packages/neon/neon/lib/src/platform/platform.dart

@ -16,7 +16,7 @@ abstract interface class NeonPlatform {
/// Infers and configures the platform automatically.
///
/// Required to be called before accessing [NeonPlatform.instance].
static Future setup() async {
static Future<void> setup() async {
if (Platform.isAndroid) {
_platform = const AndroidNeonPlatform();
} else if (Platform.isLinux) {
@ -55,5 +55,5 @@ abstract interface class NeonPlatform {
FutureOr<String> get userAccessibleAppDataPath;
FutureOr init();
FutureOr<void> init();
}

2
packages/neon/neon/lib/src/router.dart

@ -62,7 +62,7 @@ class AppRouter extends GoRouter {
routes: $appRoutes,
);
static Page _buildErrorPage(final BuildContext context, final GoRouterState state) => MaterialPage(
static Page<void> _buildErrorPage(final BuildContext context, final GoRouterState state) => MaterialPage(
child: RouteNotFoundPage(
uri: state.uri,
),

4
packages/neon/neon/lib/src/settings/models/options_collection.dart

@ -14,7 +14,7 @@ abstract class OptionsCollection implements Exportable {
/// Collection of options.
@protected
Iterable<Option> get options;
Iterable<Option<dynamic>> get options;
/// Resets all [options].
///
@ -61,5 +61,5 @@ abstract class NextcloudAppOptions extends OptionsCollection {
late final Iterable<OptionsCategory> categories;
@override
late final Iterable<Option> options;
late final Iterable<Option<dynamic>> options;
}

18
packages/neon/neon/lib/src/settings/models/storage.dart

@ -6,12 +6,12 @@ import 'package:shared_preferences/shared_preferences.dart';
abstract interface class SettingsStorage {
String? getString(final String key);
Future setString(final String key, final String value);
Future<bool> setString(final String key, final String value);
bool? getBool(final String key);
// ignore: avoid_positional_boolean_parameters
Future setBool(final String key, final bool value);
Future<bool> setBool(final String key, final bool value);
Future<bool> remove(final String key);
}
@ -53,7 +53,7 @@ final class NeonStorage {
/// Sets up the [SharedPreferences] instance.
///
/// Required to be called before accessing [database].
static Future init() async {
static Future<void> init() async {
if (_sharedPreferences != null) {
return;
}
@ -86,16 +86,16 @@ final class SingleValueStorage {
String? getString() => NeonStorage.database.getString(key.value);
Future setString(final String value) => NeonStorage.database.setString(key.value, value);
Future<bool> setString(final String value) => NeonStorage.database.setString(key.value, value);
bool? getBool() => NeonStorage.database.getBool(key.value);
// ignore: avoid_positional_boolean_parameters
Future setBool(final bool value) => NeonStorage.database.setBool(key.value, value);
Future<bool> setBool(final bool value) => NeonStorage.database.setBool(key.value, value);
List<String>? getStringList() => NeonStorage.database.getStringList(key.value);
Future setStringList(final List<String> value) => NeonStorage.database.setStringList(key.value, value);
Future<bool> setStringList(final List<String> value) => NeonStorage.database.setStringList(key.value, value);
}
@immutable
@ -130,16 +130,16 @@ final class AppStorage implements SettingsStorage {
String? getString(final String key) => NeonStorage.database.getString(formatKey(key));
@override
Future setString(final String key, final String value) => NeonStorage.database.setString(formatKey(key), value);
Future<bool> setString(final String key, final String value) => NeonStorage.database.setString(formatKey(key), value);
@override
bool? getBool(final String key) => NeonStorage.database.getBool(formatKey(key));
@override
Future setBool(final String key, final bool value) => NeonStorage.database.setBool(formatKey(key), value);
Future<bool> setBool(final String key, final bool value) => NeonStorage.database.setBool(formatKey(key), value);
List<String>? getStringList(final String key) => NeonStorage.database.getStringList(formatKey(key));
Future setStringList(final String key, final List<String> value) =>
Future<bool> setStringList(final String key, final List<String> value) =>
NeonStorage.database.setStringList(formatKey(key), value);
}

2
packages/neon/neon/lib/src/settings/widgets/settings_tile.dart

@ -10,7 +10,7 @@ abstract class SettingsTile extends StatelessWidget {
}
@internal
abstract class InputSettingsTile<T extends Option> extends SettingsTile {
abstract class InputSettingsTile<T extends Option<dynamic>> extends SettingsTile {
const InputSettingsTile({
required this.option,
super.key,

2
packages/neon/neon/lib/src/utils/account_options.dart

@ -30,7 +30,7 @@ class AccountSpecificOptions extends OptionsCollection {
final AppsBloc _appsBloc;
@override
late final List<Option> options = [
late final List<Option<dynamic>> options = [
initialApp,
];

4
packages/neon/neon/lib/src/utils/global_options.dart

@ -68,7 +68,7 @@ class GlobalOptions extends OptionsCollection {
};
@override
late final List<Option> options = [
late final List<Option<dynamic>> options = [
themeMode,
themeOLEDAsDark,
themeKeepOriginalAccentColor,
@ -101,7 +101,7 @@ class GlobalOptions extends OptionsCollection {
}
}
Future updateDistributors(final List<String> distributors) async {
Future<void> updateDistributors(final List<String> distributors) async {
pushNotificationsDistributor.values = {
for (final distributor in distributors) ...{
distributor: _distributorsMap[distributor] ?? (final _) => distributor,

2
packages/neon/neon/lib/src/utils/global_popups.dart

@ -26,7 +26,7 @@ class GlobalPopups {
bool _registered = false;
late BuildContext _context;
final _subscriptions = <StreamSubscription>[];
final _subscriptions = <StreamSubscription<dynamic>>[];
void dispose() {
for (final subscription in _subscriptions) {

2
packages/neon/neon/lib/src/utils/push_utils.dart

@ -58,7 +58,7 @@ class PushUtils {
return localNotificationsPlugin;
}
static Future onMessage(final Uint8List messages, final String instance) async {
static Future<void> onMessage(final Uint8List messages, final String instance) async {
WidgetsFlutterBinding.ensureInitialized();
final localNotificationsPlugin = await initLocalNotifications(

12
packages/neon/neon/lib/src/utils/request_manager.dart

@ -22,14 +22,14 @@ class RequestManager {
// ignore: prefer_constructors_over_static_methods
static RequestManager get instance => _requestManager ??= RequestManager();
Future initCache() async {
Future<void> initCache() async {
_cache = Cache();
await _cache!.init();
}
Cache? _cache;
Future wrapNextcloud<T, R>(
Future<void> wrapNextcloud<T, R>(
final String clientID,
final String k,
final BehaviorSubject<Result<T>> subject,
@ -51,7 +51,7 @@ class RequestManager {
0,
);
Future wrapWebDav<T>(
Future<void> wrapWebDav<T>(
final String clientID,
final String k,
final BehaviorSubject<Result<T>> subject,
@ -73,7 +73,7 @@ class RequestManager {
0,
);
Future _wrap<T, R>(
Future<void> _wrap<T, R>(
final String clientID,
final String k,
final BehaviorSubject<Result<T>> subject,
@ -189,7 +189,7 @@ class RequestManager {
class Cache {
Database? _database;
Future init() async {
Future<void> init() async {
if (_database != null) {
return;
}
@ -210,7 +210,7 @@ class Cache {
Future<String?> get(final String key) async =>
(await _database!.rawQuery('SELECT value FROM cache WHERE key = ?', [key]))[0]['value'] as String?;
Future set(final String key, final String value) async => _database!.rawQuery(
Future<void> set(final String key, final String value) async => _database!.rawQuery(
'INSERT INTO cache (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value',
[key, value],
);

4
packages/neon/neon/lib/src/widgets/app_bar.dart

@ -36,7 +36,7 @@ class _NeonAppBarState extends State<NeonAppBar> {
final _searchBarFocusNode = FocusNode();
final _searchTermController = StreamController<String>();
late final StreamSubscription _searchTermSubscription;
late final StreamSubscription<String> _searchTermSubscription;
@override
void initState() {
@ -181,7 +181,7 @@ class _NotificationIconButtonState extends State<NotificationIconButton> {
late AppsBloc _appsBloc;
late List<Account> _accounts;
late Account _account;
late StreamSubscription notificationSubscription;
late StreamSubscription<void> notificationSubscription;
@override
void initState() {

2
packages/neon/neon/lib/src/widgets/list_view.dart

@ -19,7 +19,7 @@ class NeonListView<T> extends StatelessWidget {
final Iterable<T>? items;
final bool isLoading;
final dynamic error;
final Future Function() onRefresh;
final Future<void> Function() onRefresh;
final Widget Function(BuildContext, T data) builder;
final String? scrollKey;
final bool withFloatingActionButton;

4
packages/neon/neon/test/option_test.dart

@ -45,7 +45,7 @@ void main() {
late SelectOption<SelectValues> option;
setUp(() {
when(() => storage.setString(key.value, any())).thenAnswer((final _) async {});
when(() => storage.setString(key.value, any())).thenAnswer((final _) async => true);
when(() => storage.remove(key.value)).thenAnswer((final _) async => true);
option = SelectOption<SelectValues>(
@ -209,7 +209,7 @@ void main() {
late ToggleOption option;
setUp(() {
when(() => storage.setBool(key.value, any())).thenAnswer((final _) async {});
when(() => storage.setBool(key.value, any())).thenAnswer((final _) async => true);
when(() => storage.remove(key.value)).thenAnswer((final _) async => true);
option = ToggleOption(

4
packages/neon/neon/test/options_collection_test.dart

@ -5,10 +5,10 @@ import 'package:neon/src/settings/models/storage.dart';
import 'package:test/test.dart';
// ignore: missing_override_of_must_be_overridden
class OptionMock extends Mock implements Option {}
class OptionMock extends Mock implements Option<Object> {}
class Collection extends NextcloudAppOptions {
Collection(final List<Option> options) : super(const AppStorage(StorageKeys.apps)) {
Collection(final List<Option<Object>> options) : super(const AppStorage(StorageKeys.apps)) {
super.options = options;
}
}

2
packages/neon/neon_files/lib/blocs/browser.dart

@ -37,7 +37,7 @@ class FilesBrowserBloc extends InteractiveBloc implements FilesBrowserBlocEvents
BehaviorSubject<List<String>> path = BehaviorSubject<List<String>>.seeded([]);
@override
Future refresh() async {
Future<void> refresh() async {
await RequestManager.instance.wrapWebDav<List<WebDavFile>>(
account.id,
'files-${path.value.join('/')}',

4
packages/neon/neon_files/lib/blocs/files.dart

@ -103,7 +103,7 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta
}
@override
Future refresh() async {
Future<void> refresh() async {
await browser.refresh();
}
@ -164,7 +164,7 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta
);
}
Future _downloadFile(
Future<void> _downloadFile(
final List<String> path,
final File file,
) async {

4
packages/neon/neon_files/lib/dialogs/choose_create.dart

@ -15,7 +15,7 @@ class FilesChooseCreateDialog extends StatefulWidget {
}
class _FilesChooseCreateDialogState extends State<FilesChooseCreateDialog> {
Future uploadFromPick(final FileType type) async {
Future<void> uploadFromPick(final FileType type) async {
final result = await FilePicker.platform.pickFiles(
allowMultiple: true,
type: type,
@ -27,7 +27,7 @@ class _FilesChooseCreateDialogState extends State<FilesChooseCreateDialog> {
}
}
Future upload(final File file) async {
Future<void> upload(final File file) async {
final sizeWarning = widget.bloc.options.uploadSizeWarning.value;
if (sizeWarning != null) {
final stat = file.statSync();

2
packages/neon/neon_files/lib/neon_files.dart

@ -52,7 +52,7 @@ class FilesApp extends AppImplementation<FilesBloc, FilesAppSpecificOptions> {
final String id = AppIDs.files;
@override
final LocalizationsDelegate localizationsDelegate = AppLocalizations.delegate;
final LocalizationsDelegate<AppLocalizations> localizationsDelegate = AppLocalizations.delegate;
@override
final List<Locale> supportedLocales = AppLocalizations.supportedLocales;

4
packages/neon/neon_files/lib/utils/task.dart

@ -23,7 +23,7 @@ class FilesDownloadTask extends FilesTask {
required super.file,
});
Future execute(final NextcloudClient client) async {
Future<void> execute(final NextcloudClient client) async {
await client.webdav.getFile(
Uri(pathSegments: path),
file,
@ -43,7 +43,7 @@ class FilesUploadTask extends FilesTask {
FileStat? _stat;
FileStat get stat => _stat ??= file.statSync();
Future execute(final NextcloudClient client) async {
Future<void> execute(final NextcloudClient client) async {
await client.webdav.putFile(
file,
stat,

4
packages/neon/neon_news/lib/blocs/article.dart

@ -44,7 +44,7 @@ class NewsArticleBloc extends InteractiveBloc implements NewsArticleBlocEvents,
BehaviorSubject<bool> unread = BehaviorSubject<bool>();
@override
Future refresh() async {}
Future<void> refresh() async {}
@override
void markArticleAsRead() {
@ -78,7 +78,7 @@ class NewsArticleBloc extends InteractiveBloc implements NewsArticleBlocEvents,
});
}
void _wrapArticleAction(final Future Function() call) => wrapAction(
void _wrapArticleAction(final Future<void> Function() call) => wrapAction(
call,
refresh: () async {
await _newsArticlesBloc.refresh();

4
packages/neon/neon_news/lib/blocs/articles.dart

@ -75,14 +75,14 @@ class NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBlocEvents
BehaviorSubject<FilterType> filterType = BehaviorSubject<FilterType>();
@override
Future refresh() async {
Future<void> refresh() async {
if (this is! NewsMainArticlesBloc) {
await reload();
}
await _newsBloc.refresh();
}
Future reload() async {
Future<void> reload() async {
// The API for pagination is pretty useless in this case sadly. So no pagination for us :(
// https://github.com/nextcloud/news/blob/master/docs/api/api-v1-2.md#get-items

4
packages/neon/neon_news/lib/blocs/news.dart

@ -90,7 +90,7 @@ class NewsBloc extends InteractiveBloc implements NewsBlocEvents, NewsBlocStates
late BehaviorSubject<FilterType> filterType = mainArticlesBloc.filterType;
@override
Future refresh() async {
Future<void> refresh() async {
await Future.wait([
RequestManager.instance.wrapNextcloud<List<NewsFolder>, NewsListFolders>(
account.id,
@ -187,7 +187,7 @@ class NewsBloc extends InteractiveBloc implements NewsBlocEvents, NewsBlocStates
}
@override
Future reload() async {
Future<void> reload() async {
await mainArticlesBloc.reload();
}
}

2
packages/neon/neon_news/lib/neon_news.dart

@ -59,7 +59,7 @@ class NewsApp extends AppImplementation<NewsBloc, NewsAppSpecificOptions> {
final String id = AppIDs.news;
@override
final LocalizationsDelegate localizationsDelegate = AppLocalizations.delegate;
final LocalizationsDelegate<AppLocalizations> localizationsDelegate = AppLocalizations.delegate;
@override
final List<Locale> supportedLocales = AppLocalizations.supportedLocales;

2
packages/neon/neon_news/lib/pages/article.dart

@ -63,7 +63,7 @@ class _NewsArticlePageState extends State<NewsArticlePage> {
super.dispose();
}
Future _startMarkAsReadTimer() async {
Future<void> _startMarkAsReadTimer() async {
if (await widget.bloc.unread.first) {
if (widget.articlesBloc.options.articleDisableMarkAsReadTimeoutOption.value) {
widget.bloc.markArticleAsRead();

2
packages/neon/neon_notes/lib/blocs/note.dart

@ -62,7 +62,7 @@ class NotesNoteBloc extends InteractiveBloc implements NotesNoteBlocEvents, Note
BehaviorSubject<String> category = BehaviorSubject<String>();
@override
Future refresh() async {}
Future<void> refresh() async {}
@override
void updateCategory(final String category) {

4
packages/neon/neon_notes/lib/blocs/notes.dart

@ -43,8 +43,8 @@ class NotesBloc extends InteractiveBloc implements NotesBlocEvents, NotesBlocSta
BehaviorSubject<Result<List<NotesNote>>> notes = BehaviorSubject<Result<List<NotesNote>>>();
@override
Future refresh() async {
await RequestManager.instance.wrapNextcloud<List<NotesNote>, BuiltList>(
Future<void> refresh() async {
await RequestManager.instance.wrapNextcloud<List<NotesNote>, BuiltList<NotesNote>>(
account.id,
'notes-notes',
notes,

2
packages/neon/neon_notes/lib/neon_notes.dart

@ -52,7 +52,7 @@ class NotesApp extends AppImplementation<NotesBloc, NotesAppSpecificOptions> {
final List<Locale> supportedLocales = AppLocalizations.supportedLocales;
@override
final LocalizationsDelegate localizationsDelegate = AppLocalizations.delegate;
final LocalizationsDelegate<AppLocalizations> localizationsDelegate = AppLocalizations.delegate;
@override
late final NotesAppSpecificOptions options = NotesAppSpecificOptions(storage);

2
packages/neon/neon_notifications/lib/blocs/notifications.dart

@ -49,7 +49,7 @@ class NotificationsBloc extends InteractiveBloc
BehaviorSubject<int> unreadCounter = BehaviorSubject<int>();
@override
Future refresh() async {
Future<void> refresh() async {
await RequestManager.instance
.wrapNextcloud<List<NotificationsNotification>, NotificationsEndpointListNotificationsResponseApplicationJson>(
_account.id,

2
packages/neon/neon_notifications/lib/neon_notifications.dart

@ -29,7 +29,7 @@ class NotificationsApp extends AppImplementation<NotificationsBloc, Notification
final String id = AppIDs.notifications;
@override
final LocalizationsDelegate localizationsDelegate = AppLocalizations.delegate;
final LocalizationsDelegate<AppLocalizations> localizationsDelegate = AppLocalizations.delegate;
@override
final List<Locale> supportedLocales = AppLocalizations.supportedLocales;

1
packages/neon_lints/lib/src/base.yaml

@ -1,6 +1,7 @@
analyzer:
language:
strict-casts: true
strict-raw-types: true
errors:
flutter_style_todos: ignore
todo: ignore

1
packages/neon_lints/lint_maker.yaml

@ -19,6 +19,7 @@ dart:
analyzer:
language:
strict-casts: true
strict-raw-types: true
errors:
flutter_style_todos: ignore
todo: ignore

22
packages/nextcloud/lib/src/api/news.openapi.dart

@ -154,7 +154,7 @@ class NewsClient extends DynamiteClient {
throw await NewsApiException.fromResponse(response); // coverage:ignore-line
}
Future renameFolder({
Future<void> renameFolder({
required final int folderId,
required final String name,
}) async {
@ -183,7 +183,7 @@ class NewsClient extends DynamiteClient {
throw await NewsApiException.fromResponse(response); // coverage:ignore-line
}
Future deleteFolder({required final int folderId}) async {
Future<void> deleteFolder({required final int folderId}) async {
var path = '/index.php/apps/news/api/v1-3/folders/{folderId}';
final queryParameters = <String, dynamic>{};
final headers = <String, String>{};
@ -208,7 +208,7 @@ class NewsClient extends DynamiteClient {
throw await NewsApiException.fromResponse(response); // coverage:ignore-line
}
Future markFolderAsRead({
Future<void> markFolderAsRead({
required final int folderId,
required final int newestItemId,
}) async {
@ -298,7 +298,7 @@ class NewsClient extends DynamiteClient {
throw await NewsApiException.fromResponse(response); // coverage:ignore-line
}
Future deleteFeed({required final int feedId}) async {
Future<void> deleteFeed({required final int feedId}) async {
var path = '/index.php/apps/news/api/v1-3/feeds/{feedId}';
final queryParameters = <String, dynamic>{};
final headers = <String, String>{};
@ -323,7 +323,7 @@ class NewsClient extends DynamiteClient {
throw await NewsApiException.fromResponse(response); // coverage:ignore-line
}
Future moveFeed({
Future<void> moveFeed({
required final int feedId,
final int? folderId,
}) async {
@ -354,7 +354,7 @@ class NewsClient extends DynamiteClient {
throw await NewsApiException.fromResponse(response); // coverage:ignore-line
}
Future renameFeed({
Future<void> renameFeed({
required final int feedId,
required final String feedTitle,
}) async {
@ -383,7 +383,7 @@ class NewsClient extends DynamiteClient {
throw await NewsApiException.fromResponse(response); // coverage:ignore-line
}
Future markFeedAsRead({
Future<void> markFeedAsRead({
required final int feedId,
required final int newestItemId,
}) async {
@ -504,7 +504,7 @@ class NewsClient extends DynamiteClient {
throw await NewsApiException.fromResponse(response); // coverage:ignore-line
}
Future markArticleAsRead({required final int itemId}) async {
Future<void> markArticleAsRead({required final int itemId}) async {
var path = '/index.php/apps/news/api/v1-3/items/{itemId}/read';
final queryParameters = <String, dynamic>{};
final headers = <String, String>{};
@ -529,7 +529,7 @@ class NewsClient extends DynamiteClient {
throw await NewsApiException.fromResponse(response); // coverage:ignore-line
}
Future markArticleAsUnread({required final int itemId}) async {
Future<void> markArticleAsUnread({required final int itemId}) async {
var path = '/index.php/apps/news/api/v1-3/items/{itemId}/unread';
final queryParameters = <String, dynamic>{};
final headers = <String, String>{};
@ -554,7 +554,7 @@ class NewsClient extends DynamiteClient {
throw await NewsApiException.fromResponse(response); // coverage:ignore-line
}
Future starArticle({required final int itemId}) async {
Future<void> starArticle({required final int itemId}) async {
var path = '/index.php/apps/news/api/v1-3/items/{itemId}/star';
final queryParameters = <String, dynamic>{};
final headers = <String, String>{};
@ -579,7 +579,7 @@ class NewsClient extends DynamiteClient {
throw await NewsApiException.fromResponse(response); // coverage:ignore-line
}
Future unstarArticle({required final int itemId}) async {
Future<void> unstarArticle({required final int itemId}) async {
var path = '/index.php/apps/news/api/v1-3/items/{itemId}/unstar';
final queryParameters = <String, dynamic>{};
final headers = <String, String>{};

2
packages/nextcloud/lib/src/webdav/client.dart

@ -214,7 +214,7 @@ class WebDavClient {
);
/// Gets the content of the file at [path].
Future getFile(
Future<void> getFile(
final Uri path,
final File file, {
final Function(double progress)? onProgress,

2
packages/nextcloud/test/helper.dart

@ -20,7 +20,7 @@ class DockerContainer {
final int port;
Future runOccCommand(final List<String> args) async {
Future<void> runOccCommand(final List<String> args) async {
final result = await runExecutableArguments(
'docker',
[

2
packages/nextcloud/test/notifications_test.dart

@ -21,7 +21,7 @@ void main() {
});
tearDown(() => container.destroy());
Future sendTestNotification() async {
Future<void> sendTestNotification() async {
await client.notifications.api.generateNotification(
userId: 'admin',
shortMessage: '123',

4
packages/nextcloud/test/settings_test.dart

@ -4,11 +4,11 @@ import 'package:test/test.dart';
import 'helper.dart';
Future main() async {
Future<void> main() async {
await run(await getDockerImage());
}
Future run(final DockerImage image) async {
Future<void> run(final DockerImage image) async {
group('settings', () {
late DockerContainer container;
late TestNextcloudClient client;

2
packages/sort_box/lib/sort_box.dart

@ -1,5 +1,5 @@
/// Signature of a function returning a [Comparable].
typedef ComparableGetter<T> = Comparable Function(T);
typedef ComparableGetter<T> = Comparable<Object> Function(T);
/// Sorting Box to sort [List]s on multiple properties.
class SortBox<T extends Enum, R> {

Loading…
Cancel
Save