feedbackDataSourceProvider top-level property

Provider<FeedbackDataSource> feedbackDataSourceProvider
final

Provides the current FeedbackDataSource instance.

Implementation

final feedbackDataSourceProvider = Provider<FeedbackDataSource>(
  (ref) {
    final apiService = ref.watch(apiServiceProvider);
    final userToken = ref.watch(userTokenProvider);

    return userToken.when(
      data: (token) => StdFeedbackDataSource(apiService, token),
      error: (_, __) => TokenUnavailableFeedbackDataSource(),
      loading: () => TokenUnavailableFeedbackDataSource(),
    );
  },
);