All Projects → GetStream → stream-feed-flutter

GetStream / stream-feed-flutter

Licence: other
Stream Feed official Flutter SDK. Build your own feed experience using Dart and Flutter.

Programming Languages

dart
5743 projects
HTML
75241 projects
ruby
36898 projects - #4 most used programming language
swift
15916 projects
kotlin
9241 projects
shell
77523 projects

Projects that are alternatives of or similar to stream-feed-flutter

Winds
A Beautiful Open Source RSS & Podcast App Powered by Getstream.io
Stars: ✭ 8,530 (+12631.34%)
Mutual labels:  feed, getstream
stream-ruby
Ruby Client - Build Activity Feeds & Streams with GetStream.io
Stars: ✭ 81 (+20.9%)
Mutual labels:  feed, activity-feed
stream-python
Python Client - Build Activity Feeds & Streams with GetStream.io
Stars: ✭ 134 (+100%)
Mutual labels:  feed, activity-feed
Stream Framework
Stream Framework is a Python library, which allows you to build news feed, activity streams and notification systems using Cassandra and/or Redis. The authors of Stream-Framework also provide a cloud service for feed technology:
Stars: ✭ 4,576 (+6729.85%)
Mutual labels:  feed, activity-feed
Stream Go2
GetStream.io Go client
Stars: ✭ 67 (+0%)
Mutual labels:  stream, feed
Stream Php
PHP Client - Build Activity Feeds & Streams with GetStream.io
Stars: ✭ 129 (+92.54%)
Mutual labels:  stream, feed
stream-net
NET Client - Build Activity Feeds & Streams with GetStream.io
Stars: ✭ 28 (-58.21%)
Mutual labels:  feed, activity-feed
f43.me
A more readable & cleaner feed
Stars: ✭ 60 (-10.45%)
Mutual labels:  feed
devwebfeed
Firehose of team++ resources
Stars: ✭ 128 (+91.04%)
Mutual labels:  feed
flutter nfc kit
Flutter plugin to provide NFC functionality on Android and iOS, including reading metadata, read & write NDEF records, and transceive layer 3 & 4 data with NFC tags / cards
Stars: ✭ 119 (+77.61%)
Mutual labels:  flutter-plugin
umeng analytics plugin
Flutter 版友盟统计插件
Stars: ✭ 20 (-70.15%)
Mutual labels:  flutter-plugin
android-chat-tutorial
Sample apps for the Stream Chat Android SDK's official tutorial
Stars: ✭ 44 (-34.33%)
Mutual labels:  stream
plugin.video.sendtokodi
📺 plays various stream sites on kodi using youtube-dl
Stars: ✭ 86 (+28.36%)
Mutual labels:  stream
Free-RASP-Flutter
Flutter library for improving app security and threat monitoring on Android and iOS mobile devices.
Stars: ✭ 62 (-7.46%)
Mutual labels:  flutter-plugin
fancy bar
A fancy yet beautiful animated widget for your Flutter apps
Stars: ✭ 33 (-50.75%)
Mutual labels:  flutter-plugin
SensorNode
SensorNode-client application for IOTA.
Stars: ✭ 35 (-47.76%)
Mutual labels:  stream
nats-dart
NATS client for Dart lang
Stars: ✭ 31 (-53.73%)
Mutual labels:  flutter-plugin
aushape
A library and a tool for converting audit logs to XML and JSON
Stars: ✭ 37 (-44.78%)
Mutual labels:  stream
tpack
Pack a Go workflow/function as a Unix-style pipeline command
Stars: ✭ 55 (-17.91%)
Mutual labels:  stream
flutter-maplibre-gl
A flutter package for showing customizable vector/raster maps with Maplibre GL (forked from tobrun/flutter-mapbox-gl)
Stars: ✭ 69 (+2.99%)
Mutual labels:  flutter-plugin

Official Flutter packages for Stream Activity Feeds

The official Dart client for Stream Activity Feeds, a service for building activity feed applications. This library can be used on any Dart project and on both mobile and web apps with Flutter. You can sign up for a Stream account at https://getstream.io/get_started.

Note: The user interface for the activity feed can vary widely across different apps. Most of our activity feed customers integrate with Stream via their backend and build their own UI. This takes advantage of Stream’s scalability while keeping full control over the UI. We update this library but not as frequently as other SDKs.

Pub Build status codecov melos

Stream Feed Activity Feed cover image

🔗 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

🛠 Installation

Install from pub

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

dependencies:
  flutter:
    sdk: flutter

  stream_feed: ^[latest-version]

Using with Flutter

This package can be integrated into Flutter applications. Remember to not expose the App Secret in your Flutter web apps, mobile apps, or other non-trusted environments like desktop apps.

🔌 Usage

API client setup Serverside + Clientside

If you want to use the API client directly on your web/mobile app you need to generate a user token server-side and pass it.

Server-side token generation

// Instantiate a new client (server side)
const apiKey = 'my-API-key';
const secret = 'my-API-secret';

// Instantiate a new client (server side)
var client = StreamFeedClient(apiKey, secret: secret);

// Optionally supply the app identifier and an options object specifying the data center to use and timeout for requests (15s)
client = StreamFeedClient(apiKey,
      secret: secret,
      appId: 'yourappid',
      options: StreamHttpClientOptions(
          location: Location.usEast, connectTimeout: Duration(seconds: 15)));

// Create a token for user with id "the-user-id"
final userToken = client.frontendToken('the-user-id');

⚠️ for security, you must never expose your API secret or generated client side token, and it's highly recommended to use exp claim in client side token.

Client API init

// Instantiate new client with a user token
var client = StreamFeedClient(apiKey, token: Token('userToken'));

🔮 Examples

// Instantiate a feed object server side
var user1 = client.flatFeed('user', '1');

// Get activities from 5 to 10 (slow pagination)
final activities = await user1.getActivities(limit: 5, offset: 5);
// Filter on an id less than a given UUID
final filtered_activities = await user1.getActivities(
      limit: 5,
      filter: Filter().idLessThan('e561de8f-00f1-11e4-b400-0cc47a024be0')

// All API calls are performed asynchronous and return a Promise object
await user1
    .getActivities(
        limit: 5,
        filter: Filter().idLessThan('e561de8f-00f1-11e4-b400-0cc47a024be0'))
    .then((value) => /* on success */
        print(value))
    .onError((error,
              stackTrace) => /* on failure, reason.error contains an explanation */
        print(error));

// Create a new activity
final activity = Activity( actor: '1', verb: 'tweet', object: '1', foreignId: 'tweet:1' );
final added_activity = await user1.addActivity(activity);
// Create a bit more complex activity
final complex_activity = Activity(
    actor: '1',
    verb: 'run',
    object: '1',
    foreignId: 'run:1',
    extraData: {
      'course': {'name': 'Golden Gate park', 'distance': 10},
      'participants': ['Thierry', 'Tommaso'],
      'started_at': DateTime.now().toIso8601String(),
    },
  );
final added_complex_activity = await user1.addActivity(complex_activity);

// Remove an activity by its id
await user1.removeActivityById('e561de8f-00f1-11e4-b400-0cc47a024be0');
// or remove by the foreign id
await user1.removeActivityByForeignId('tweet:1');

// mark a notification feed as read
await notification1.getActivities(
  marker: ActivityMarker().allRead(),
);


// mark a notification feed as seen
await notification1.getActivities(
  marker: ActivityMarker().allSeen(),
);

// Follow another feed
await user1.follow(client.flatFeed('flat', '42'));

// Stop following another feed
await user1.unfollow(client.flatFeed('flat', '42'));

// Stop following another feed while keeping previously published activities
// from that feed
await user1.unfollow(client.flatFeed('flat', '42'), keepHistory: true);

// Follow another feed without copying the history
await user1.follow(client.flatFeed('flat', '42'), activityCopyLimit: 0);

// List followers, following
await user1.getFollowers(limit: 10, offset: 10);
await user1.getFollowed(limit: 10, offset: 0);


await user1.follow(client.flatFeed('flat', '42'));

// adding multiple activities
const activities = [
  Activity(actor: '1', verb: 'tweet', object: '1'),
  Activity(actor: '2', verb: 'tweet', object: '3'),
];
await user1.addActivities(activities);

// specifying additional feeds to push the activity to using the to param
// especially useful for notification style feeds
final to = FeedId.fromIds(['user:2', 'user:3']);
final activityTo = Activity(
  to: to,
  actor: '1',
  verb: 'tweet',
  object: '1',
  foreignId: 'tweet:1',
);
await user1.addActivity(activityTo);


// adding one activity to multiple feeds
final feeds = FeedId.fromIds(['flat:1', 'flat:2', 'flat:3', 'flat:4']);
final activityTarget = Activity(
  actor: 'User:2',
  verb: 'pin',
  object: 'Place:42',
  target: 'Board:1',
);

// ⚠️ server-side only!
await client.batch.addToMany(activityTarget, feeds!);

// Batch create follow relations (let flat:1 follow user:1, user:2 and user:3 feeds in one single request)
const follows = [
  FollowRelation(source: 'flat:1', target: 'user:1'),
  FollowRelation(source:'flat:1', target: 'user:2'),
  FollowRelation(source:'flat:1', target: 'user:3'),
];

// ⚠️ server-side only!
await client.batch.followMany(follows);

// Updating parts of an activity
final set = {
  'product.price': 19.99,
  shares: {
    facebook: '...',
    twitter: '...',
  },
};
final unset = ['daily_likes', 'popularity'];

// ...by ID
final update = ActivityUpdate.withId( '54a60c1e-4ee3-494b-a1e3-50c06acb5ed4', set, unset);
await client.updateActivityById(update);
// ...or by combination of foreign ID and time
const timestamp = DateTime.now();
const foreignID= 'product:123';
final update2 = ActivityUpdate.withForeignId(
  foreignID,
  timestamp,
  set,
  unset,
);
await client.updateActivityById(update2);


// update the 'to' fields on an existing activity
// client.flatFeed("user", "ken").function (foreign_id, timestamp, new_targets, added_targets, removed_targets)
// new_targets, added_targets, and removed_targets are all arrays of feed IDs
// either provide only the `new_targets` parameter (will replace all targets on the activity),
// OR provide the added_targets and removed_targets parameters
// NOTE - the updateActivityToTargets method is not intended to be used in a browser environment.
await client.flatFeed('user', 'ken').updateActivityToTargets('foreign_id:1234', timestamp, ['feed:1234']);
await client.flatFeed('user', 'ken').updateActivityToTargets('foreign_id:1234', timestamp, null, ['feed:1234']);
await client.flatFeed('user', 'ken').updateActivityToTargets('foreign_id:1234', timestamp, null, null, ['feed:1234']);

Realtime (Faye)

Stream uses Faye for realtime notifications. Below is quick guide to subscribing to feed changes

// ⚠️ userToken is generated server-side (see previous section)
final client = StreamFeedClient('YOUR_API_KEY', token: userToken,appId: 'APP_ID');
final user1 = client.flatFeed('user', '1');

// subscribe to the changes
final subscription = await userFeed.subscribe((message) => print(message));
// now whenever something changes to the feed user 1
// the callback will be called

// To cancel a subscription you can call cancel on the
// object returned from a subscribe call.
// This will remove the listener from this channel.
await subscription.cancel();

Docs are available on GetStream.io.

Free for Makers

Stream is free for most side and hobby projects. To qualify your project/company needs to have < 5 team members and < $10k in monthly revenue. For complete pricing details visit our Feed Pricing Page

Structure

Stream Feed Dart is a monorepo built using Melos. Individual packages can be found in the packages directory while configuration and top level commands can be found in melos.yaml.

To get started, run bootstrap after cloning the project.

melos bootstrap

Dart version requirements

This API Client project requires Dart v2.12 at a minimum.

See the github action configuration for details of how it is built, tested and packaged.

Contributing

See extensive at test documentation for your changes.

You can find generic API documentation enriched by code snippets from this package at https://getstream.io/activity-feeds/docs/flutter-dart/?language=dart

Copyright and License Information

Project is licensed under the BSD 3-Clause.

We are hiring

We've recently closed a $38 million Series B funding round and we keep actively growing. Our APIs are used by more than a billion end-users, and you'll have a chance to make a huge impact on the product within a team of the strongest engineers all over the world.

Check out our current openings and apply via Stream's website.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].