stream_feed_flutter_core 0.8.0 copy "stream_feed_flutter_core: ^0.8.0" to clipboard
stream_feed_flutter_core: ^0.8.0 copied to clipboard

Stream Feed official Flutter SDK Core. Build your own feed experience using Dart and Flutter.

Official Core Flutter SDK for Stream Feeds #

The official Flutter core components for Stream Feeds, a service for building activity feeds.

🔗 Quick Links

  • Register to get an API key for Stream Activity Feeds
  • Tutorial to learn how to setup a timeline feed, follow other feeds and post new activities.
  • Stream Activity Feeds UI Kit to jumpstart your design with notifications and social feeds

Install from pub Pub

Next step is to add stream_feed_flutter_core to your dependencies, to do that just open pubspec.yaml and add it inside the dependencies section.

dependencies:
  flutter:
    sdk: flutter

  stream_feed_flutter_core: ^[latest-version]

Then run flutter packages get

This package requires no custom setup on any platform since it does not depend on any platform-specific dependency.

Changelog #

Check out the changelog on pub.dev to see the latest changes in the package.

Usage #

This package provides business logic to fetch common things required for integrating Stream Feeds into your application. The core package allows more customisation and hence provides business logic but no UI components.

A simple example:

import 'package:flutter/material.dart';
import 'package:stream_feed_flutter_core/stream_feed_flutter_core.dart';

void main() {
  const apiKey = 'API-KEY';
  const userToken = 'USER-TOKEN';
  final client = StreamFeedClient(apiKey);

  await client.setUser(
    const User(
      id: 'GroovinChip',
      data: {
        'handle': '@GroovinChip',
        'first_name': 'Reuben',
        'last_name': 'Turner',
        'full_name': 'Reuben Turner',
        'profile_image': 'https://avatars.githubusercontent.com/u/4250470?v=4',
      },
    ),
    const Token(userToken),
  );

  runApp(
    MaterialApp(
      /// Wrap your application in a `FeedProvider`. This requires a `FeedBloc`.
      /// The `FeedBloc` is used to perform various Stream Feed operations.
      builder: (context, child) => FeedProvider(
        bloc: FeedBloc(client: client),
        child: child!,
      ),
      home: Scaffold(
        /// Returns `Activities`s for the given `feedGroup` in the `feedBuilder`.
        body: FlatFeedCore(
          feedGroup: 'user',
          feedBuilder: (BuildContext context, activities, int index) {
            return InkWell(
              child: Column(children: [
                Text("${activities[index].actor}"),
                Text("${activities[index].object}"),
              ]),
              onTap: () {
                Navigator.of(context).push(
                  MaterialPageRoute<void>(
                    builder: (BuildContext context) => Scaffold(
                      /// Returns `Reaction`s for the given
                      /// `lookupValue` in the `reactionsBuilder`.
                      body: ReactionListCore(
                        lookupValue: activities[index].id!,
                        reactionsBuilder: (context, reactions, idx) =>
                            Text("${reactions[index].data?["text"]}"),
                      ),
                    ),
                  ),
                );
              },
            );
          },
        ),
      ),
    ),
  );
}

Docs #

This package provides business logic to fetch common things required for integrating Stream Feed into your application. The core package allows more customisation and hence provides business logic but no UI components. Use stream_feed for the low-level client.

The package primarily contains three types of classes:

  1. Business Logic Components
  2. Core Components

Business Logic Components #

These components allow you to have the maximum and lower-level control of the queries being executed. The BLoCs we provide are:

  1. FeedBloc: manage activity and reaction streams
  2. UplaodController: manage upload streams (Progress,Fail,Success)

Core Components #

Core components usually are an easy way to fetch data associated with Stream Feed which are decoupled from UI and often expose UI builders. Data fetching can be controlled with the controllers of the respective core components.

  1. FlatFeedCore : given an Activity Widget builder render a reactive list of activities
  2. ReactionListCore: given an Reaction Widget builder render a reactive list of reactions
  3. UploadListCore: expose a reactive list of uploads via a callback
  4. FeedProvider: an Inherited widget providing access to FeedBloc in the widget tree

Contributing #

We welcome code changes that improve this library or fix a problem, please make sure to follow all best practices and add tests if applicable before submitting a Pull Request on Github. We are pleased to merge your code into the official repository. Make sure to sign our Contributor License Agreement (CLA) first. See our license file for more details.

13
likes
130
points
72
downloads

Publisher

verified publishergetstream.io

Weekly Downloads

Stream Feed official Flutter SDK Core. Build your own feed experience using Dart and Flutter.

Homepage
Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

unknown (license)

Dependencies

dio, equatable, flutter, meta, rxdart, stream_feed

More

Packages that depend on stream_feed_flutter_core