v0.4.0
Pre-release
Pre-release
stream_feed
0.4.0
Changelog
- breaking:
StreamFeedClient.connect
is nowStreamFeedClient
for better user session handling.
The connect verb was confusing, and made you think that it will perform the connection immediately. Also, it doesn't infer the id anymore from the token anymore. You can now have to callsetUser
down the tree or beforerunApp
- breaking:
setUser
now takes aUser
(must contain id) and a token. Passing the user token in the client constructor was making the whole instance depend on a single user. - new: we support generics
EnrichedActivity
is nowGenericEnrichedActivity<A,Ob,T,Or>
in order to have a more flexible API surface. Those generic parameters can be as follows:
A = [actor]: can be an User, String
Ob = [object] can a String, or a CollectionEntry
T = [target] can be a String or an Activity
Or = [origin] can be a String or a Reaction or a User - breaking: along with these changes we removed the
EnrichableField
field fromEnrichedActivity
- new: there is a type definition
EnrichedActivity
to handle most use cases ofGenericEnrichedActivity
(User,String,String,String) - fix: a time drift issue in a token generation when using the low-level client sever-side
- bump: dart SDK package constraints to 2.14 to make use of typedefs for nonfunction types
stream_feed_flutter_core
0.4.0
First Release of Core 🎉
This package provides business logic to fetch common things required for integrating Stream Feed into your application.
The core package allows more customization 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:
- Business Logic Components
- 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:
- FeedBloc
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.
- FlatFeedCore (Fetch a list of activities)
- ReactionListCore (Fetch a list of reactions)
- FeedProvider (Inherited widget providing FeedBloc to the widget tree)
Usage
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,
token: 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"]}"),
),
),
),
);
},
);
},
),
),
),
);
}