multi_bloc_builder 1.0.0 copy "multi_bloc_builder: ^1.0.0" to clipboard
multi_bloc_builder: ^1.0.0 copied to clipboard

VERY COOL MULTI BLOC BUILDER

Getting started #

flutter pub add multi_bloc_builder

Usage #

import 'package:multi_bloc_builder/multi_bloc_builder.dart';

MultiBlocConsumer(
    blocs: [
        context.watch<DataOneCubit>(),
        context.watch<DataTwoCubit>(),
    ],
    buildWhen: (next, prev) {
        log('BUILD WHEN: $next, $prev');
        return true;
    },
    listener: (context, states) {
        log('LISTENER: $states');
    },
    listenWhen: (next, prev) {
        log('LISTEN WHEN: $next, $prev');
        return true;
    },
    builder: (context, states) {
        DataOneState one = states[0];
        DataTwoState two = states[1];
        
        return Column(
            children: [
                Text(one.toString()),
                Text(two.toString()),
            ],
        );
    },
),