AppFlowy/frontend/appflowy_flutter/lib/plugins/util.dart
Mathias Mogensen acc03b8cc4
chore: code cleanup according to unintroduced lints (#4488)
* chore: remove redundant arguments

* chore: remove unused constructor params

* chore: reorganize constructors

* chore: remove unnecessary awaits in returns

* chore: remove unnecessary paranthesis

* chore: add lints

* chore: clean up after merge

* chore: add sort constructors first

* chore: organize constructors in blocs

* chore: use sizedbox.shrink over empty container
2024-01-25 23:37:36 +08:00

33 lines
977 B
Dart

import 'package:appflowy/startup/plugin/plugin.dart';
import 'package:appflowy/workspace/application/view/view_listener.dart';
import 'package:dartz/dartz.dart';
import 'package:appflowy_backend/log.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
import 'package:flutter/material.dart';
class ViewPluginNotifier extends PluginNotifier<Option<DeletedViewPB>> {
ViewPluginNotifier({
required this.view,
}) : _viewListener = ViewListener(viewId: view.id) {
_viewListener?.start(
onViewUpdated: (updatedView) => view = updatedView,
onViewMoveToTrash: (result) => result.fold(
(deletedView) => isDeleted.value = some(deletedView),
(err) => Log.error(err),
),
);
}
ViewPB view;
final ViewListener? _viewListener;
@override
final ValueNotifier<Option<DeletedViewPB>> isDeleted = ValueNotifier(none());
@override
void dispose() {
isDeleted.dispose();
_viewListener?.stop();
}
}