Release Maintained

flutter_graphql_client

flutter_graphql_client is an open source project — it's one among many other shared libraries that make up the wider ecosystem of software made and open sourced by Savannah Informatics Limited.

A shared library for BeWell-Consumer and BeWell-Professional that is responsible for exposing graphql_client and helper methods for use in the various apps.

This package implements functions to make API calls. This blends both GRAPHQL and REST. Since graphql make this bulk of this package, the name of the package favours.

Installation Instructions

Use this package as a library by depending on it

Run this command:

  • With Flutter:
$ flutter pub add flutter_graphql_client

This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):

dependencies:
  flutter_graphql_client: ^0.1.23

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

Lastly:

Import it like so:

import 'package:flutter_graphql_client/graph_client.dart';

How to use this package

Making GRAPHQL calls

final dynamic data = await SimpleCall.callAPI(
    querystring: 'valid-query-string' ,
    variables: <String, dynamic>{'pay':'load'},
    graphClient: graphQlClientInstance ,
)

Making REST calls

GET

final dynamic data = await SimpleCall.callRestAPI(
    endpoint: 'http://example.com/test' ,
    method: 'GET',
    graphClient: graphQlClientInstance ,
)

POST

final dynamic data = await SimpleCall.callRestAPI(
    endpoint: 'http://example.com/test' ,
    method: 'POST',
    variables: <String, dynamic>{'pay':'load'},
    graphClient: graphQlClientInstance ,
)

Dart & Flutter Version

  • Dart 2: >= 2.12
  • Flutter: >=2.0.0

Developing & Contributing

First off, thanks for taking the time to contribute!

Be sure to check out detailed instructions on how to contribute to this project here and go through out Code of Conduct.

GPG Signing: As a contributor, you need to sign your commits. For more details check here

License

This library is distributed under the MIT license found in the LICENSE file.

Libraries

graph_client
graph_constants
graph_event_bus
graph_sqlite
graph_utils