Skip to content

Commit

Permalink
Merge pull request #29 from zino-app/patch-5
Browse files Browse the repository at this point in the history
Patch 5
  • Loading branch information
HofmannZ authored Jul 11, 2018
2 parents 5bed7af + 9d4125b commit ff1cc7e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## [0.5.2] - July 11 2018

### Breaking change

n/a

#### Fixes / Enhancements

- Fixed error when cache file is non-existent

#### Docs

n/a

## [0.5.1] - June 29 2018

### Breaking change
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ First depend on the library by adding this to your packages `pubspec.yaml`:

```yaml
dependencies:
graphql_flutter: ^0.5.1
graphql_flutter: ^0.5.2
```
Now inside your Dart code you can import it.
Expand Down
21 changes: 12 additions & 9 deletions lib/src/cache/in_memory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,22 @@ class InMemoryCache {
Future<HashMap<String, dynamic>> _readFromStorage() async {
try {
final File file = await _localStorageFile;
Stream<dynamic> inputStream = file.openRead();

final HashMap<String, dynamic> storedHashMap =
new HashMap<String, dynamic>();

inputStream
.transform(utf8.decoder) // Decode bytes to UTF8.
.transform(new LineSplitter()) // Convert stream to individual lines.
.listen((String line) {
final List keyAndValue = json.decode(line);
if (file.existsSync()) {
Stream<dynamic> inputStream = file.openRead();

inputStream
.transform(utf8.decoder) // Decode bytes to UTF8.
.transform(
new LineSplitter()) // Convert stream to individual lines.
.listen((String line) {
final List keyAndValue = json.decode(line);

storedHashMap[keyAndValue[0]] = keyAndValue[1];
});
storedHashMap[keyAndValue[0]] = keyAndValue[1];
});
}

return storedHashMap;
} on FileSystemException {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: graphql_flutter
description: A GraphQL client for Flutter.
version: 0.5.1
version: 0.5.2
authors:
- Eus Dima <eus@zinoapp.com>
- Zino Hofmann <zino@zinoapp.com>
Expand Down

0 comments on commit ff1cc7e

Please # to comment.