Skip to content

Commit

Permalink
Merge pull request #925 from nextcloud/style/neon/remove-inferred-gen…
Browse files Browse the repository at this point in the history
…eric-arguments

style(neon): Remove automatically inferred generic type arguments
  • Loading branch information
provokateurin authored Oct 4, 2023
2 parents ff76bf7 + c699654 commit 64c5649
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 30 deletions.
2 changes: 1 addition & 1 deletion packages/neon/neon/lib/src/blocs/accounts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class AccountsBloc extends Bloc implements AccountsBlocEvents, AccountsBlocState
BehaviorSubject<List<Account>> accounts = BehaviorSubject<List<Account>>.seeded([]);

@override
BehaviorSubject<Account?> activeAccount = BehaviorSubject<Account?>();
BehaviorSubject<Account?> activeAccount = BehaviorSubject();

@override
void addAccount(final Account account) {
Expand Down
12 changes: 5 additions & 7 deletions packages/neon/neon/lib/src/blocs/apps.dart
Original file line number Diff line number Diff line change
Expand Up @@ -175,18 +175,17 @@ class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates
}

@override
BehaviorSubject<AppImplementation> activeApp = BehaviorSubject<AppImplementation>();
BehaviorSubject<AppImplementation> activeApp = BehaviorSubject();

@override
BehaviorSubject<Result<Iterable<AppImplementation<Bloc, NextcloudAppOptions>>>> appImplementations =
BehaviorSubject<Result<Iterable<AppImplementation>>>();
BehaviorSubject();

@override
BehaviorSubject<Result<List<CoreNavigationEntry>>> apps = BehaviorSubject<Result<List<CoreNavigationEntry>>>();
BehaviorSubject<Result<List<CoreNavigationEntry>>> apps = BehaviorSubject();

@override
BehaviorSubject<Result<NotificationsAppInterface?>> notificationsAppImplementation =
BehaviorSubject<Result<NotificationsAppInterface?>>();
BehaviorSubject<Result<NotificationsAppInterface?>> notificationsAppImplementation = BehaviorSubject();

@override
BehaviorSubject<void> openNotifications = BehaviorSubject();
Expand All @@ -196,8 +195,7 @@ class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates

@override
Future<void> refresh() async {
await RequestManager.instance
.wrapNextcloud<List<CoreNavigationEntry>, CoreNavigationGetAppsNavigationResponseApplicationJson, void>(
await RequestManager.instance.wrapNextcloud(
_account.id,
'apps-apps',
apps,
Expand Down
6 changes: 2 additions & 4 deletions packages/neon/neon/lib/src/blocs/capabilities.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,11 @@ class CapabilitiesBloc extends InteractiveBloc implements CapabilitiesBlocEvents
}

@override
BehaviorSubject<Result<CoreOcsGetCapabilitiesResponseApplicationJson_Ocs_Data>> capabilities =
BehaviorSubject<Result<CoreOcsGetCapabilitiesResponseApplicationJson_Ocs_Data>>();
BehaviorSubject<Result<CoreOcsGetCapabilitiesResponseApplicationJson_Ocs_Data>> capabilities = BehaviorSubject();

@override
Future<void> refresh() async {
await RequestManager.instance.wrapNextcloud<CoreOcsGetCapabilitiesResponseApplicationJson_Ocs_Data,
CoreOcsGetCapabilitiesResponseApplicationJson, void>(
await RequestManager.instance.wrapNextcloud(
_account.id,
'capabilities',
capabilities,
Expand Down
2 changes: 1 addition & 1 deletion packages/neon/neon/lib/src/blocs/login_flow.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class LoginFlowBloc extends InteractiveBloc implements LoginFlowBlocEvents, Logi
}

@override
BehaviorSubject<Result<CoreLoginFlowV2>> init = BehaviorSubject<Result<CoreLoginFlowV2>>();
BehaviorSubject<Result<CoreLoginFlowV2>> init = BehaviorSubject();

@override
late Stream<CoreLoginFlowV2Credentials> result = _resultController.stream.asBroadcastStream();
Expand Down
6 changes: 2 additions & 4 deletions packages/neon/neon/lib/src/blocs/user_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,11 @@ class UserDetailsBloc extends InteractiveBloc implements UserDetailsBlocEvents,
}

@override
BehaviorSubject<Result<ProvisioningApiUserDetails>> userDetails =
BehaviorSubject<Result<ProvisioningApiUserDetails>>();
BehaviorSubject<Result<ProvisioningApiUserDetails>> userDetails = BehaviorSubject();

@override
Future<void> refresh() async {
await RequestManager.instance
.wrapNextcloud<ProvisioningApiUserDetails, ProvisioningApiUsersGetCurrentUserResponseApplicationJson, void>(
await RequestManager.instance.wrapNextcloud(
_account.id,
'user-details',
userDetails,
Expand Down
3 changes: 1 addition & 2 deletions packages/neon/neon/lib/src/blocs/user_statuses.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ class UserStatusesBloc extends InteractiveBloc implements UserStatusesBlocEvents
}

@override
BehaviorSubject<Map<String, Result<UserStatusPublicInterface?>>> statuses =
BehaviorSubject<Map<String, Result<UserStatusPublicInterface?>>>();
BehaviorSubject<Map<String, Result<UserStatusPublicInterface?>>> statuses = BehaviorSubject();

@override
Future<void> refresh() async {
Expand Down
4 changes: 2 additions & 2 deletions packages/neon/neon/lib/src/pages/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class _HomePageState extends State<HomePage> {
);
}

return StreamBuilder<AppImplementation>(
return StreamBuilder(
stream: _appsBloc.activeApp,
builder: (final context, final activeAppIDSnapshot) {
if (!activeAppIDSnapshot.hasData) {
Expand All @@ -163,7 +163,7 @@ class _HomePageState extends State<HomePage> {
},
);

final body = ValueListenableBuilder<global_options.NavigationMode>(
final body = ValueListenableBuilder(
valueListenable: _globalOptions.navigationMode,
builder: (final context, final navigationMode, final _) {
final drawerAlwaysVisible = navigationMode == global_options.NavigationMode.drawerAlwaysVisible;
Expand Down
5 changes: 2 additions & 3 deletions packages/neon/neon/lib/src/pages/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:flutter_material_design_icons/flutter_material_design_icons.dart
import 'package:meta/meta.dart';
import 'package:neon/l10n/localizations.dart';
import 'package:neon/src/blocs/accounts.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/models/app_implementation.dart';
import 'package:neon/src/platform/platform.dart';
import 'package:neon/src/router.dart';
Expand Down Expand Up @@ -82,14 +81,14 @@ class _SettingsPageState extends State<SettingsPage> {
),
],
);
final body = StreamBuilder<List<Account>>(
final body = StreamBuilder(
stream: accountsBloc.accounts,
initialData: accountsBloc.accounts.valueOrNull,
builder: (
final context,
final accountsSnapshot,
) =>
ValueListenableBuilder<bool>(
ValueListenableBuilder(
valueListenable: globalOptions.pushNotificationsEnabled,
builder: (
final context,
Expand Down
4 changes: 2 additions & 2 deletions packages/neon/neon/lib/src/utils/global_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class GlobalOptions extends OptionsCollection {
}
}

late final themeMode = SelectOption<ThemeMode>(
late final themeMode = SelectOption(
storage: storage,
key: GlobalOptionKeys.themeMode,
label: (final context) => AppLocalizations.of(context).globalOptionsThemeMode,
Expand Down Expand Up @@ -202,7 +202,7 @@ class GlobalOptions extends OptionsCollection {
values: {},
);

late final navigationMode = SelectOption<NavigationMode>(
late final navigationMode = SelectOption(
storage: storage,
key: GlobalOptionKeys.navigationMode,
label: (final context) => AppLocalizations.of(context).globalOptionsNavigationMode,
Expand Down
4 changes: 2 additions & 2 deletions packages/neon/neon/lib/src/widgets/app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ class _NeonAppBarState extends State<NeonAppBar> {
@override
Widget build(final BuildContext context) => ResultBuilder<Iterable<AppImplementation>>.behaviorSubject(
stream: appsBloc.appImplementations,
builder: (final context, final appImplementations) => StreamBuilder<AppImplementation>(
builder: (final context, final appImplementations) => StreamBuilder(
stream: appsBloc.activeApp,
builder: (final context, final activeAppSnapshot) => StreamBuilder<bool>(
builder: (final context, final activeAppSnapshot) => StreamBuilder(
stream: unifiedSearchBloc.enabled,
builder: (final context, final unifiedSearchEnabledSnapshot) {
final unifiedSearchEnabled = unifiedSearchEnabledSnapshot.data ?? false;
Expand Down
2 changes: 1 addition & 1 deletion packages/neon/neon/lib/src/widgets/image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class NeonCachedImage extends StatefulWidget {
class _NeonCachedImageState extends State<NeonCachedImage> {
@override
Widget build(final BuildContext context) => Center(
child: FutureBuilder<Uint8List>(
child: FutureBuilder(
future: widget.image,
builder: (final context, final fileSnapshot) {
if (fileSnapshot.hasError) {
Expand Down
2 changes: 1 addition & 1 deletion packages/neon/neon/lib/src/widgets/user_avatar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class _UserAvatarState extends State<NeonUserAvatar> {
alignment: Alignment.center,
children: [
avatar,
ResultBuilder<UserStatusPublicInterface?>(
ResultBuilder(
stream: _userStatusBloc.statuses.mapNotNull((final statuses) => statuses[widget.username]),
builder: _userStatusIconBuilder,
),
Expand Down

0 comments on commit 64c5649

Please sign in to comment.