Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

780 B
Raw Blame
import 'package:flutter/material.dart';

import 'package:appflowy/plugins/inline_actions/service_handler.dart';

abstract class _InlineActionsProvider {
  void dispose();
}

class InlineActionsService extends _InlineActionsProvider {
  InlineActionsService({
    required this.context,
    required this.handlers,
  });

  /// The [BuildContext] in which to show the [InlineActionsMenu]
  ///
  BuildContext? context;

  final List<InlineActionsDelegate> handlers;

  /// This is a workaround for not having a mounted check.
  /// Thus when the widget that uses the service is disposed,
  /// we set the [BuildContext] to null.
  ///
  @override
  Future<void> dispose() async {
    for (final handler in handlers) {
      await handler.dispose();
    }
    context = null;
  }
}