pipeline_plus 1.1.0 copy "pipeline_plus: ^1.1.0" to clipboard
pipeline_plus: ^1.1.0 copied to clipboard

A Pipeline allows you to pass data through a series of pipes to perform a sequence of operations with the data.

example/pipeline_plus_example.dart

import 'package:pipeline_plus/pipeline_plus.dart';

import 'model/user.dart';
import 'services/add_member_to_team_service.dart';
import 'services/register_user_service.dart';
import 'services/send_welcome_email_service.dart';

void main() async {
  var pipeline = Pipeline()
    ..send(data: User())
    ..onFailure(callback: (passable, exception) {
      // do something
    })
    ..through(
      pipes: [
        RegisterUserService(),
        AddMemberToTeamService(),
        (User user) {
          // do something
          return user;
        },
        SendWelcomeEmailService(),
      ],
    );

  print('pipeline: ${await pipeline.thenReturn()}');

  var userPipeline = User().pipeThrough(
    pipes: [
      RegisterUserService(),
      AddMemberToTeamService(),
      (User user) {
        // do something
        return user;
      },
      SendWelcomeEmailService(),
    ],
  );

  print('userPipeline: ${await userPipeline.thenReturn()}');
}
3
likes
160
pub points
0%
popularity

Publisher

verified publisherfaaytech.com

A Pipeline allows you to pass data through a series of pipes to perform a sequence of operations with the data.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

More

Packages that depend on pipeline_plus