More stringent CI check
MODIFY
.cirrus.yml
.cirrus.yml
@@ -7,9 +7,9 @@ test_task:
# fingerprint_script: cat pubspec.lock
# populate_script: pub get
pub_script: flutter packages get # later when we seperate graphql_client and graphql_flutter, we can change this
- # format_script: dartfmt **/*.dart -n --set-exit-if-changed
+ format_script: dartfmt **/*.dart -n --set-exit-if-changed
# analyze_script: dartanalyzer --fatal-infos .
- # publishable_script: pub publish --dry-run
+ publishable_script: pub publish --dry-run
environment:
CODECOV_TOKEN: ENCRYPTED[fa57a1dda8bca6ad45ef10043f632b68b7824b60c634415f741a847788c1a44ae9374155e3af3346fb9b6d72bac0e1d3]
test_script:

MODIFY
CHANGELOG.md
CHANGELOG.md
-## [1.0.0-beta.1] - February 16 2019
+## [1.0.0-beta.1+1] - February 16 2019
We are finally in BETA. This means we're one step closer to our first stable release.
Thanks to all the contributes.
+Support GraphQL Upload spec as proposed at
+https://github.com/jaydenseric/graphql-multipart-request-spec
+
### What's changed?
We have added a brand new `Link` that handles authentication. You can drop it in like so:

MODIFY
example/lib/bloc.dart
example/lib/bloc.dart
@@ -22,7 +22,7 @@ class Bloc {
_toggleStarSubject.listen((Repo t) async {
_toggleStarLoadingSubject.add(true);
// @todo handle error
- final r = await _mutateToggleStar(t);
+ final QueryResult _ = await _mutateToggleStar(t);
_repoSubject.add(_repoSubject.value.map((Repo e) {
if (e.id != t.id) {
@@ -67,7 +67,7 @@ class Bloc {
link: _link,
);
- Future<void> _mutateToggleStar(Repo repo) async {
+ Future<QueryResult> _mutateToggleStar(Repo repo) async {
final MutationOptions _options = MutationOptions(
document:
repo.viewerHasStarred ? mutations.removeStar : mutations.addStar,

MODIFY
example/pubspec.yaml
example/pubspec.yaml
@@ -5,7 +5,7 @@ dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
- rxdart: 0.21.0
+ rxdart: ^0.21.0
graphql_flutter:
path: ..

MODIFY
lib/src/core/observable_query.dart
lib/src/core/observable_query.dart
@@ -38,7 +38,9 @@ class ObservableQuery {
final QueryManager queryManager;
final Set<StreamSubscription<QueryResult>> _onDataSubscriptions =
- <StreamSubscription<QueryResult>>{};
+ // @todo Set literal is only supported from Dart 2.2 we are running Dart 2.0
+ // ignore: prefer_collection_literals
+ Set<StreamSubscription<QueryResult>>();
QueryLifecycle lifecycle = QueryLifecycle.UNEXECUTED;

MODIFY
lib/src/link/http/link_http.dart
lib/src/link/http/link_http.dart
import 'dart:async';
import 'dart:convert';
import 'dart:io';
+import 'dart:typed_data';
import 'package:meta/meta.dart';
import 'package:http/http.dart';
@@ -25,6 +26,8 @@ class HttpLink extends Link {
Map<String, dynamic> credentials,
Map<String, dynamic> fetchOptions,
}) : super(
+ // @todo possibly this is a bug in dart analyzer
+ // ignore: undefined_named_parameter
request: (
Operation operation, [
NextLink forward,
@@ -105,7 +108,7 @@ Map<String, File> _getFileMap(
}) {
currentMap ??= <String, File>{};
if (body is Map<String, dynamic>) {
- final entries = body.entries;
+ final Iterable<MapEntry<String, dynamic>> entries = body.entries;
for (MapEntry<String, dynamic> element in entries) {
currentMap.addAll(_getFileMap(
element.value,
@@ -154,18 +157,17 @@ Future<BaseRequest> _prepareRequest(
return object.toJson();
});
- // @todo fileMap.keys.toList() and fileMap.values.toList() same order????
- final Map<String, List<String>> adasd =
- {}; // fileMap.keys.toList().asMap().map((int index, String filePath) => MapEntry(index.toString(),[filePath]));
- final List<MultipartFile> fileList = [];
+ final Map<String, List<String>> fileMapping = <String, List<String>>{};
+ final List<MultipartFile> fileList = <MultipartFile>[];
- final fEn = fileMap.entries.toList(growable: false);
+ final List<MapEntry<String, File>> fileMapEntries =
+ fileMap.entries.toList(growable: false);
- for (int i = 0; i < fEn.length; i++) {
- final MapEntry<String, File> entry = fEn[i];
+ for (int i = 0; i < fileMapEntries.length; i++) {
+ final MapEntry<String, File> entry = fileMapEntries[i];
final String indexString = i.toString();
- adasd.addAll({
- indexString: [entry.key]
+ fileMapping.addAll(<String, List<String>>{
+ indexString: <String>[entry.key],
});
final File f = entry.value;
final String fileName = basename(f.path);
@@ -178,9 +180,7 @@ Future<BaseRequest> _prepareRequest(
));
}
- final rfieldsmap = json.encode(adasd);
-
- r.fields['map'] = rfieldsmap;
+ r.fields['map'] = json.encode(fileMapping);
r.files.addAll(fileList);
return r;
@@ -286,7 +286,7 @@ Future<FetchResult> _parseResponse(StreamedResponse response) async {
try {
final Encoding encoding = _determineEncodingFromResponse(response);
// @todo limit bodyBytes
- final reponseByte = await response.stream.toBytes();
+ final Uint8List reponseByte = await response.stream.toBytes();
final String decodedBody = encoding.decode(reponseByte);
final Map<String, dynamic> jsonResponse =

MODIFY
pubspec.yaml
pubspec.yaml
@@ -11,13 +11,15 @@ dependencies:
sdk: flutter
meta: ^1.1.6
http: ^0.12.0
- mime: 0.9.6+2
+ mime: ^0.9.6+2
+ path: ^1.6.2
http_parser: ^3.1.3
path_provider: ^0.5.0
uuid: ^2.0.0
graphql_parser: ^1.1.1
dev_dependencies:
+ rxdart: ^0.21.0 # for `example/` only to please pub publish --dry-run
perfectionist: ^2.0.0
mockito: ^4.0.0
flutter_test:

MODIFY
test/graphql_flutter_test.dart
test/graphql_flutter_test.dart
@@ -105,7 +105,7 @@ void main() {
final List<int> bytes = utf8.encode(body);
final Stream<List<int>> stream =
- Stream<List<int>>.fromIterable([bytes]);
+ Stream<List<int>>.fromIterable(<List<int>>[bytes]);
final http.StreamedResponse r = http.StreamedResponse(stream, 200);
@@ -228,7 +228,7 @@ void main() {
String boundary, List<File> files) async {
final List<Function> expectContinuationList = (() {
int i = 0;
- return [
+ return <Function>[
// ExpectString
(Uint8List actual, String expected) => expect(
String.fromCharCodes(actual.sublist(i, i += expected.length)),

More stringent CI check (#3)