Skip to content

Commit

Permalink
refactor: Remove unnecessary generic type arguments
Browse files Browse the repository at this point in the history
Signed-off-by: provokateurin <kate@provokateurin.de>
  • Loading branch information
provokateurin committed Feb 13, 2024
1 parent 200c8c2 commit 33ba9fa
Show file tree
Hide file tree
Showing 52 changed files with 126 additions and 148 deletions.
6 changes: 3 additions & 3 deletions packages/neon/neon_dashboard/lib/src/blocs/dashboard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class _DashboardBloc extends InteractiveBloc implements DashboardBloc {
}
}

await Future.wait<void>([
await Future.wait([
if (v1WidgetIDs.isNotEmpty)
RequestManager.instance.wrapNextcloud(
account: account,
Expand Down Expand Up @@ -85,10 +85,10 @@ class _DashboardBloc extends InteractiveBloc implements DashboardBloc {
static const int maxItems = 7;

@override
final widgets = BehaviorSubject<Result<BuiltList<dashboard.Widget>>>();
final widgets = BehaviorSubject();

@override
final items = BehaviorSubject<Result<BuiltMap<String, dashboard.WidgetItems>>>();
final items = BehaviorSubject();

@override
void dispose() {
Expand Down
2 changes: 1 addition & 1 deletion packages/neon/neon_dashboard/test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Widget wrapWidget(AccountsBloc accountsBloc, Widget child) => MaterialApp(
supportedLocales: DashboardLocalizations.supportedLocales,
home: Scaffold(
backgroundColor: Colors.transparent,
body: NeonProvider<AccountsBloc>.value(
body: NeonProvider.value(
value: accountsBloc,
child: child,
),
Expand Down
6 changes: 3 additions & 3 deletions packages/neon/neon_files/lib/src/blocs/browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ class _FilesBrowserBloc extends InteractiveBloc implements FilesBrowserBloc {
}

@override
BehaviorSubject<Result<List<WebDavFile>>> files = BehaviorSubject<Result<List<WebDavFile>>>();
final files = BehaviorSubject();

@override
BehaviorSubject<PathUri> uri = BehaviorSubject.seeded(PathUri.cwd());
final uri = BehaviorSubject.seeded(PathUri.cwd());

@override
Future<void> refresh() async {
await RequestManager.instance.wrapWebDav<List<WebDavFile>>(
await RequestManager.instance.wrapWebDav(
account: account,
cacheKey: 'files-${uri.value.path}',
subject: files,
Expand Down
2 changes: 1 addition & 1 deletion packages/neon/neon_files/lib/src/blocs/files.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class _FilesBloc extends InteractiveBloc implements FilesBloc {
}

@override
BehaviorSubject<List<FilesTask>> tasks = BehaviorSubject<List<FilesTask>>.seeded([]);
final tasks = BehaviorSubject.seeded([]);

@override
void addFavorite(PathUri uri) {
Expand Down
12 changes: 6 additions & 6 deletions packages/neon/neon_files/lib/src/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class FilesOptions extends AppImplementationOptions {
name: (context) => FilesLocalizations.of(context).general,
);

late final filesSortPropertyOption = SelectOption<FilesSortProperty>(
late final filesSortPropertyOption = SelectOption(
storage: super.storage,
category: generalCategory,
key: FilesOptionKeys.sortProperty,
Expand All @@ -38,7 +38,7 @@ class FilesOptions extends AppImplementationOptions {
},
);

late final filesSortBoxOrderOption = SelectOption<SortBoxOrder>(
late final filesSortBoxOrderOption = SelectOption(
storage: super.storage,
category: generalCategory,
key: FilesOptionKeys.sortOrder,
Expand All @@ -63,7 +63,7 @@ class FilesOptions extends AppImplementationOptions {
defaultValue: true,
);

late final uploadQueueParallelism = SelectOption<int>(
late final uploadQueueParallelism = SelectOption(
storage: storage,
category: generalCategory,
key: FilesOptionKeys.uploadQueueParallelism,
Expand All @@ -76,7 +76,7 @@ class FilesOptions extends AppImplementationOptions {
},
);

late final downloadQueueParallelism = SelectOption<int>(
late final downloadQueueParallelism = SelectOption(
storage: storage,
category: generalCategory,
key: FilesOptionKeys.downloadQueueParallelism,
Expand Down Expand Up @@ -106,7 +106,7 @@ class FilesOptions extends AppImplementationOptions {

int _mb(int i) => i * 1024 * 1024;

late final uploadSizeWarning = SelectOption<int?>(
late final uploadSizeWarning = SelectOption(
storage: storage,
category: generalCategory,
key: FilesOptionKeys.uploadSizeWarning,
Expand All @@ -115,7 +115,7 @@ class FilesOptions extends AppImplementationOptions {
values: _sizeWarningValues,
);

late final downloadSizeWarning = SelectOption<int?>(
late final downloadSizeWarning = SelectOption(
storage: storage,
category: generalCategory,
key: FilesOptionKeys.downloadSizeWarning,
Expand Down
2 changes: 1 addition & 1 deletion packages/neon/neon_files/lib/src/widgets/actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class FileActions extends StatelessWidget {
}

@override
Widget build(BuildContext context) => PopupMenuButton<FilesFileAction>(
Widget build(BuildContext context) => PopupMenuButton(
itemBuilder: (context) => [
if (!details.isDirectory && NeonPlatform.instance.canUseSharing)
PopupMenuItem(
Expand Down
8 changes: 4 additions & 4 deletions packages/neon/neon_files/lib/src/widgets/browser_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ class _FilesBrowserViewState extends State<FilesBrowserView> {
}

@override
Widget build(BuildContext context) => ResultBuilder<List<WebDavFile>>.behaviorSubject(
Widget build(BuildContext context) => ResultBuilder.behaviorSubject(
subject: widget.bloc.files,
builder: (context, filesSnapshot) => StreamBuilder<PathUri>(
builder: (context, filesSnapshot) => StreamBuilder(
stream: widget.bloc.uri,
builder: (context, uriSnapshot) => StreamBuilder<List<FilesTask>>(
builder: (context, uriSnapshot) => StreamBuilder(
stream: widget.filesBloc.tasks,
builder: (context, tasksSnapshot) {
if (!uriSnapshot.hasData || !tasksSnapshot.hasData) {
Expand All @@ -57,7 +57,7 @@ class _FilesBrowserViewState extends State<FilesBrowserView> {
}
return false;
},
child: SortBoxBuilder<FilesSortProperty, WebDavFile>(
child: SortBoxBuilder(
sortBox: filesSortBox,
sortProperty: widget.bloc.options.filesSortPropertyOption,
sortBoxOrder: widget.bloc.options.filesSortBoxOrderOption,
Expand Down
2 changes: 1 addition & 1 deletion packages/neon/neon_files/lib/src/widgets/dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class FilesChooseFolderDialog extends StatelessWidget {
Widget build(BuildContext context) {
final dialogTheme = NeonDialogTheme.of(context);

return StreamBuilder<PathUri>(
return StreamBuilder(
stream: bloc.uri,
builder: (context, uriSnapshot) {
final actions = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class _FileIcon extends StatelessWidget {
Widget build(BuildContext context) {
Widget icon = Center(
child: details.hasTask
? StreamBuilder<double>(
? StreamBuilder(
stream: details.task!.progress,
builder: (context, progress) => Column(
children: [
Expand Down
2 changes: 1 addition & 1 deletion packages/neon/neon_files/lib/src/widgets/file_preview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class FilePreview extends StatelessWidget {
);
}

return ValueListenableBuilder<bool>(
return ValueListenableBuilder(
valueListenable: bloc.options.showPreviewsOption,
builder: (context, showPreviews, _) {
if (showPreviews && (details.hasPreview ?? false)) {
Expand Down
4 changes: 2 additions & 2 deletions packages/neon/neon_news/lib/src/blocs/article.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ class _NewsArticleBloc extends InteractiveBloc implements NewsArticleBloc {
}

@override
BehaviorSubject<bool> starred = BehaviorSubject<bool>();
final starred = BehaviorSubject();

@override
BehaviorSubject<bool> unread = BehaviorSubject<bool>();
final unread = BehaviorSubject();

@override
Future<void> refresh() async {}
Expand Down
6 changes: 3 additions & 3 deletions packages/neon/neon_news/lib/src/blocs/articles.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ class _NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBloc {
}

@override
BehaviorSubject<Result<BuiltList<news.Article>>> articles = BehaviorSubject<Result<BuiltList<news.Article>>>();
final articles = BehaviorSubject();

@override
BehaviorSubject<FilterType> filterType = BehaviorSubject<FilterType>();
final filterType = BehaviorSubject();

@override
Future<void> refresh() async {
Expand Down Expand Up @@ -145,7 +145,7 @@ class _NewsArticlesBloc extends InteractiveBloc implements NewsArticlesBloc {
}
}

await RequestManager.instance.wrapNextcloud<BuiltList<news.Article>, news.ListArticles, void>(
await RequestManager.instance.wrapNextcloud(
account: account,
cacheKey: 'news-articles-${type.index}-$id-$getRead',
subject: articles,
Expand Down
14 changes: 7 additions & 7 deletions packages/neon/neon_news/lib/src/blocs/news.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,31 +94,31 @@ class _NewsBloc extends InteractiveBloc implements NewsBloc, NewsMainArticlesBlo
}

@override
BehaviorSubject<Result<BuiltList<news.Feed>>> feeds = BehaviorSubject<Result<BuiltList<news.Feed>>>();
final feeds = BehaviorSubject();

@override
BehaviorSubject<Result<BuiltList<news.Folder>>> folders = BehaviorSubject<Result<BuiltList<news.Folder>>>();
final folders = BehaviorSubject();

@override
BehaviorSubject<int> unreadCounter = BehaviorSubject<int>();
final unreadCounter = BehaviorSubject();

@override
late BehaviorSubject<Result<BuiltList<news.Article>>> articles = mainArticlesBloc.articles;
late final articles = mainArticlesBloc.articles;

@override
late BehaviorSubject<FilterType> filterType = mainArticlesBloc.filterType;
late final filterType = mainArticlesBloc.filterType;

@override
Future<void> refresh() async {
await Future.wait([
RequestManager.instance.wrapNextcloud<BuiltList<news.Folder>, news.ListFolders, void>(
RequestManager.instance.wrapNextcloud(
account: account,
cacheKey: 'news-folders',
subject: folders,
rawResponse: account.client.news.listFoldersRaw(),
unwrap: (response) => response.body.folders,
),
RequestManager.instance.wrapNextcloud<BuiltList<news.Feed>, news.ListFeeds, void>(
RequestManager.instance.wrapNextcloud(
account: account,
cacheKey: 'news-feeds',
subject: feeds,
Expand Down
20 changes: 10 additions & 10 deletions packages/neon/neon_news/lib/src/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class NewsOptions extends AppImplementationOptions {
name: (context) => NewsLocalizations.of(context).feeds,
);

late final defaultCategoryOption = SelectOption<DefaultCategory>(
late final defaultCategoryOption = SelectOption(
storage: super.storage,
category: generalCategory,
key: NewsOptionKeys.defaultCategory,
Expand All @@ -57,7 +57,7 @@ class NewsOptions extends AppImplementationOptions {
},
);

late final articleViewTypeOption = SelectOption<ArticleViewType>(
late final articleViewTypeOption = SelectOption(
storage: super.storage,
category: articlesCategory,
key: NewsOptionKeys.articleViewType,
Expand All @@ -80,7 +80,7 @@ class NewsOptions extends AppImplementationOptions {
defaultValue: false,
);

late final defaultArticlesFilterOption = SelectOption<FilterType>(
late final defaultArticlesFilterOption = SelectOption(
storage: super.storage,
category: articlesCategory,
key: NewsOptionKeys.defaultArticlesFilter,
Expand All @@ -93,7 +93,7 @@ class NewsOptions extends AppImplementationOptions {
},
);

late final articlesSortPropertyOption = SelectOption<ArticlesSortProperty>(
late final articlesSortPropertyOption = SelectOption(
storage: super.storage,
category: articlesCategory,
key: NewsOptionKeys.articlesSortProperty,
Expand All @@ -108,7 +108,7 @@ class NewsOptions extends AppImplementationOptions {
},
);

late final articlesSortBoxOrderOption = SelectOption<SortBoxOrder>(
late final articlesSortBoxOrderOption = SelectOption(
storage: super.storage,
category: articlesCategory,
key: NewsOptionKeys.articlesSortBoxOrder,
Expand All @@ -117,7 +117,7 @@ class NewsOptions extends AppImplementationOptions {
values: sortBoxOrderOptionValues,
);

late final foldersSortPropertyOption = SelectOption<FoldersSortProperty>(
late final foldersSortPropertyOption = SelectOption(
storage: super.storage,
category: foldersCategory,
key: NewsOptionKeys.foldersSortProperty,
Expand All @@ -130,7 +130,7 @@ class NewsOptions extends AppImplementationOptions {
},
);

late final foldersSortBoxOrderOption = SelectOption<SortBoxOrder>(
late final foldersSortBoxOrderOption = SelectOption(
storage: super.storage,
category: foldersCategory,
key: NewsOptionKeys.foldersSortBoxOrder,
Expand All @@ -139,7 +139,7 @@ class NewsOptions extends AppImplementationOptions {
values: sortBoxOrderOptionValues,
);

late final defaultFolderViewTypeOption = SelectOption<DefaultFolderViewType>(
late final defaultFolderViewTypeOption = SelectOption(
storage: super.storage,
category: foldersCategory,
key: NewsOptionKeys.defaultFolderViewType,
Expand All @@ -151,7 +151,7 @@ class NewsOptions extends AppImplementationOptions {
},
);

late final feedsSortPropertyOption = SelectOption<FeedsSortProperty>(
late final feedsSortPropertyOption = SelectOption(
storage: super.storage,
category: feedsCategory,
key: NewsOptionKeys.feedsSortProperty,
Expand All @@ -163,7 +163,7 @@ class NewsOptions extends AppImplementationOptions {
},
);

late final feedsSortBoxOrderOption = SelectOption<SortBoxOrder>(
late final feedsSortBoxOrderOption = SelectOption(
storage: super.storage,
category: feedsCategory,
key: NewsOptionKeys.feedsSortBoxOrder,
Expand Down
4 changes: 2 additions & 2 deletions packages/neon/neon_news/lib/src/pages/article.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class _NewsArticlePageState extends State<NewsArticlePage> {
strokeWidth: 2,
),
),
StreamBuilder<bool>(
StreamBuilder(
stream: widget.bloc.starred,
builder: (context, starredSnapshot) {
final starred = starredSnapshot.data ?? false;
Expand All @@ -155,7 +155,7 @@ class _NewsArticlePageState extends State<NewsArticlePage> {
);
},
),
StreamBuilder<bool>(
StreamBuilder(
stream: widget.bloc.unread,
builder: (context, unreadSnapshot) {
final unread = unreadSnapshot.data ?? false;
Expand Down
13 changes: 6 additions & 7 deletions packages/neon/neon_news/lib/src/widgets/articles_view.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:built_collection/built_collection.dart';
import 'package:flutter/material.dart';
import 'package:html/dom.dart' as html_dom;
import 'package:html/parser.dart' as html_parser;
Expand Down Expand Up @@ -44,11 +43,11 @@ class _NewsArticlesViewState extends State<NewsArticlesView> {
}

@override
Widget build(BuildContext context) => ResultBuilder<BuiltList<news.Feed>>.behaviorSubject(
Widget build(BuildContext context) => ResultBuilder.behaviorSubject(
subject: widget.newsBloc.feeds,
builder: (context, feeds) => ResultBuilder<BuiltList<news.Article>>.behaviorSubject(
builder: (context, feeds) => ResultBuilder.behaviorSubject(
subject: widget.bloc.articles,
builder: (context, articles) => SortBoxBuilder<ArticlesSortProperty, news.Article>(
builder: (context, articles) => SortBoxBuilder(
sortBox: articlesSortBox,
sortProperty: widget.newsBloc.options.articlesSortPropertyOption,
sortBoxOrder: widget.newsBloc.options.articlesSortBoxOrderOption,
Expand All @@ -74,11 +73,11 @@ class _NewsArticlesViewState extends State<NewsArticlesView> {
);
},
topFixedChildren: [
StreamBuilder<FilterType>(
StreamBuilder(
stream: widget.bloc.filterType,
builder: (context, selectedFilterTypeSnapshot) => Container(
margin: const EdgeInsets.symmetric(horizontal: 15),
child: DropdownButton<FilterType>(
child: DropdownButton(
isExpanded: true,
value: selectedFilterTypeSnapshot.data,
items: [
Expand All @@ -87,7 +86,7 @@ class _NewsArticlesViewState extends State<NewsArticlesView> {
if (widget.bloc.listType == null) ...[
FilterType.starred,
],
].map<DropdownMenuItem<FilterType>>(
].map(
(a) {
late final String label;
switch (a) {
Expand Down
Loading

0 comments on commit 33ba9fa

Please sign in to comment.