gql_dio_link 0.0.4

  • Readme
  • Changelog
  • Example
  • Installing
  • 72

Similar to gql_http_link, This is a GQL Terminating Link to execute requests via Dio using JSON.

Usage #

A simple usage example:

import "package:dio/dio.dart";
import "package:gql_link/gql_link.dart";
import "package:gql_dio_link/gql_dio_link.dart";

void main () {
  final dio = Dio();
  final link = Link.from([
    // SomeLink(),
    DioLink("/graphql", client: dio),
  ]);
}

Features and bugs #

Please file feature requests and bugs at the GitHub.

[0.0.1] - TODO: Add release date. #

  • TODO: Describe initial release.

example/lib/main.dart

import "package:dio/dio.dart" as dio;
import 'package:gql/language.dart' as gqlLang;
import 'package:gql_dio_link/gql_dio_link.dart';
import 'package:gql_exec/gql_exec.dart';
import "package:gql_link/gql_link.dart";

const query = """{
  countries(filter:{currency:{eq:"EGP"}}){
    name
  }
}""";

const graphqlEndpoint = "https://countries.trevorblades.com/";

void main(List<String> arguments) async {
  final client = dio.Dio();

  final Link link = DioLink(
    graphqlEndpoint,
    client: client,
  );

  final res = await link
      .request(Request(
        operation: Operation(document: gqlLang.parseString(query)),
      ))
      .first;

  final countryName = res.data["countries"][0]["name"];

  print("The country that uses EGP as a form of curruncy is ${countryName}");
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  gql_dio_link: ^0.0.4

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:gql_dio_link/gql_dio_link.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
48
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
72
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.2 <3.0.0
dio ^3.0.9 3.0.9
gql_exec ^0.2.4 0.2.4 0.2.5-alpha+1594319799511
gql_link ^0.3.0 0.3.0 0.3.1-alpha+1594319799521
meta ^1.1.8 1.2.2 1.3.0-nullsafety
Transitive dependencies
charcode 1.1.3
http_parser 3.1.4
path 1.7.0
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.2.0 1.3.0-nullsafety
Dev dependencies
collection ^1.14.12 1.14.13 1.15.0-nullsafety
gql ^0.12.1 0.12.3 0.12.4-alpha+1594319799502
gql_pedantic ^1.0.1
mockito ^4.1.1
test ^1.0.0