opened
Overman775
username_0
- tweks
- clean
- fix tests
- check required params
- update pub
- preloaderColor
PR dev-bloc
issue
created
Overman775
username_0
@username_1 About stream.broadcast()... its bad way to use for one listener/transform, but i can't fix this, hot reload send error mesages 😕
comment
created
aissat
username_1
I have suggestions to make this for all PKG
comment
created
Overman775
username_0
What exactly do you want to do?
comment
created
aissat
username_1
comment
created
aissat
username_1
@username_0  check #103
comment
created
aissat
username_1
wat i want to do :
- fixed #103  coz `_translations=null` by using Stream 
file `lib/src/localization.dart`
`final String resource = this._translations.get(key);`

```dart
if (await assetLoader.localeExists(localePath) == true) {
      Map<String, dynamic> data = await assetLoader.load(localePath);
      instance._translations = Translations(data);
      return true;
    }
```
- added  Handle File load errors in widget error like this

![Simulator Screen Shot - iPhone 11 Pro Max - 2020-03-22 at 20 30 36](https://user-images.githubusercontent.com/4768203/77858310-9b54a580-71fa-11ea-877b-f9309ef0bb01.png)
comment
created
Overman775
username_0
Yes, I see a problem when the resource loader does not finish loading the `text ("company_name" .tr ())` tries to get the translation, but return null.

I think the flickering text and this bug it is same
comment
created
aissat
username_1
@username_0  check this part 
`_translations=null` by using Stream 
file `lib/src/localization.dart`
`final String resource = this._translations.get(key);`

```dart
if (await assetLoader.localeExists(localePath) == true) {
      Map<String, dynamic> data = await assetLoader.load(localePath);
      instance._translations = Translations(data);
      return true;
    }
```
comment
created
Overman775
username_0
Problem in final `String resource = this._translations.get(key);`

we are try get(key) BUT this._translations = null at this moment...Yep

```
if (await assetLoader.localeExists(localePath) == true) {
      Map<String, dynamic> data = await assetLoader.load(localePath);
      instance._translations = Translations(data);
      return true;
      assetLoadedStream.sink.add(true) <--- send strim like done or error
    }
```
Use **StreamZip** from https://pub.dev/packages/async#-readme-tab-
```
  @override
  Widget build(BuildContext context) {
    return Container(
      color: widget.preloaderColor,
      child: StreamBuilder(
          stream: StreamZip([bloc.outStream, assetLoadedStream]),
          builder: (context, snapshot) {
```

This is a theory 🤔
comment
created
aissat
username_1
@username_0 nice :) my idea something like this:

``` dart
  final validate = StreamTransformer<Locale, Locale>.fromHandlers(
      handleData: (locale, sink) async {
    if (locale != null ) {
      await _init();
      log('easy localization:  init() ');
      sink.add(locale);
    } else if( !assetLoader.isLoade ){
      sink.addError("assetLoader error ");
      log('easy localization: assetLoader error');
    }else {
      sink.add(locale);

    }
  });
```
comment