Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

bloc concurrency demos

coverage
style: very good analysis
license: mit

3 different scenarios demonstrating how to structure blocs to take advantage of concurrent event processing in bloc 7.2/8.0. each bloc is implemented twice: the old way using mapeventtostate, and the new way using on<event>().

video streaming demo

demonstrates a bloc that listens to a stream.

video streaming demo

cloud file storage demo

demonstrates a bloc that processes events concurrently.

cloud file storage demo

registration form demo

demonstrates how to use custom event transformers.

registration form demo

generated by the very good cli ��


getting started ��

to run the desired flavor either use the launch configuration in vscode/android studio or use the following commands:

# development
$ flutter run --flavor development --target lib/main_development.dart

# staging
$ flutter run --flavor staging --target lib/main_staging.dart

# production
$ flutter run --flavor production --target lib/main_production.dart

*bloc concurrency demos works on ios, android, and web.


running tests ��

to run all unit and widget tests use the following command:

$ flutter test --coverage --test-randomize-ordering-seed random

to view the generated coverage report you can use lcov.

# generate coverage report
$ genhtml coverage/lcov.info -o coverage/

# open coverage report
$ open coverage/index.html

working with translations ��

this project relies on flutter_localizations and follows the official internationalization guide for flutter.

adding strings

  1. to add a new localizable string, open the app_en.arb file at lib/l10n/arb/app_en.arb.
{
    "@@locale": "en",
    "counterappbartitle": "counter",
    "@counterappbartitle": {
        "description": "text shown in the appbar of the counter page"
    }
}
  1. then add a new key/value and description
{
    "@@locale": "en",
    "counterappbartitle": "counter",
    "@counterappbartitle": {
        "description": "text shown in the appbar of the counter page"
    },
    "helloworld": "hello world",
    "@helloworld": {
        "description": "hello world text"
    }
}
  1. use the new string
import 'package:bloc_concurrency_demos/l10n/l10n.dart';

@override
widget build(buildcontext context) {
  final l10n = context.l10n;
  return text(l10n.helloworld);
}

adding supported locales

update the cfbundlelocalizations array in the info.plist at ios/runner/info.plist to include the new locale.

    ...

    <key>cfbundlelocalizations</key>
	<array>
		<string>en</string>
		<string>es</string>
	</array>

    ...

adding translations

  1. for each supported locale, add a new arb file in lib/l10n/arb.
├── l10n
│   ├── arb
│   │   ├── app_en.arb
│   │   └── app_es.arb
  1. add the translated strings to each .arb file:

app_en.arb

{
    "@@locale": "en",
    "counterappbartitle": "counter",
    "@counterappbartitle": {
        "description": "text shown in the appbar of the counter page"
    }
}

app_es.arb

{
    "@@locale": "es",
    "counterappbartitle": "contador",
    "@counterappbartitle": {
        "description": "texto mostrado en la appbar de la página del contador"
    }
}

Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Top