Skip to content

Fixed 'Unhandled Exception: type 'Null' is not a subtype of type 'FutureOr<ChargeResponse>'' #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 54 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,61 @@

<p align="center">
<img title="Flutterwave" height="200" src="https://flutterwave.com/images/logo-colored.svg" width="50%"/>
<img title="Flutterwave" height="200" src="https://flutterwave.com/images/logo/full.svg" width="50%"/>
</p>

# Flutterwave Flutter Standard SDK
# Flutterwave Flutter SDK (Standard)

## Table of Contents
The Flutter library helps you create seamless payment experiences in your dart mobile app. By connecting to our modal, you can start collecting payment in no time.

- [About](#about)
- [Getting Started](#getting-started)
- [Usage](#usage)
- [Deployment](#deployment)
- [Built Using](#build-tools)
- [References](#references)
- [Support](#support)

<a id="about"></a>
## About
Flutterwave's Flutter SDK is Flutterwave's offical flutter sdk to integrate Flutterwave's [Standard](https://developer.flutterwave.com/docs/flutterwave-standard) payment into your flutter app. It comes with a ready made Drop In UI.
Available features include:

- Collections: Card, Account, Mobile money, Bank Transfers, USSD, Barter.
- Recurring payments: Tokenization and Subscriptions.
- Split payments


<a id="getting-started"></a>
## Table of Contents

## Getting Started
1. [Requirements](#requirements)
2. [Installation](#installation)
3. [Usage](#usage)
4. [Support](#support)
5. [Contribution guidelines](#contribution-guidelines)
6. [License](#license)

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See [deployment](#deployment) for notes on how to deploy the project on a live system.
See [references](#references) for links to dashboard and API documentation.

## Requirements
- Ensure you have your test (and live) [API keys](https://developer.flutterwave.com/docs/api-keys).
``` Flutter version >= 1.17.0 Flutterwave version 3 API keys ```

## Installation Add the dependency
1. Flutterwave for business [API Keys](https://developer.flutterwave.com/docs/integration-guides/authentication)
2. Supported Flutter version >= 1.17.0


## Installation

In your `pubspec.yaml` file add:
1. Add the dependency to your project. In your `pubspec.yaml` file add: `flutterwave_standard: 1.0.2`
2. Run `flutter pub get`

1. `flutterwave_standard: ^1.0.4`
2. run `flutter pub get`
<a id="usage"></a>

## Usage

Create a `Flutterwave` instance by calling the constructor `Flutterwave` The constructor accepts a mandatory instance of the following:
the calling `Context` , `publicKey`, `Customer`, `amount`, `currency`, `email`, `fullName`, `txRef`, `isDebug`, `paymentOptions`, and `Customization` . It returns an instance of `Flutterwave` which we then call the `async` method `.charge()` on.
### Initializing a Flutterwave instance

To create an instance, you should call the Flutterwave constructor. This constructor accepts a mandatory instance of the following:

- The calling `Context`
- `publicKey`
- `Customer`
- `amount`
- `currency`
- `email`
- `fullName`
- `txRef`
- `isDebug`
- `paymentOptions`
- `Customization`

It returns an instance of Flutterwave which we then call the async method `.charge()` on.

_handlePaymentInitialization() async {
final style = FlutterwaveStyle(
Expand Down Expand Up @@ -86,10 +98,9 @@ the calling `Context` , `publicKey`, `Customer`, `amount`, `currency`, `email`,
);
}

### 2. Handle the response
### Handling the response

Calling the `.charge()` method returns a `Future`
of `ChargeResponse` which we await for the actual response as seen above.
Calling the `.charge()` method returns a Future of `ChargeResponse` which we await for the actual response as seen above.



Expand All @@ -105,45 +116,34 @@ of `ChargeResponse` which we await for the actual response as seen above.
// User cancelled
}

#### Please note that:
- `ChargeResponse` can be null, depending on if the user cancels
the transaction by pressing back.
- You need to check the status of the transaction from the instance of `ChargeResponse` returned from calling `.charge()`, the `status`, `success` and `txRef` are successful and correct before providing value to the customer
#### Note

> **PLEASE NOTE**
1. `ChargeResponse` can be null if a user cancels the transaction by pressing back.
2. You need to confirm the transaction is succesful. Ensure that the txRef, amount, and status are correct and successful. Be sure to [verify the transaction details](https://developer.flutterwave.com/docs/verifications/transaction) before providing value.

> We advise you to do a further verification of transaction's details on your server to be sure everything checks out before providing service.
<a id="deployment"></a>

## Support

##Testing
`pub run test`
For additional assistance using this library, contact the developer experience (DX) team via [email](mailto:[email protected]) or on [slack](https://bit.ly/34Vkzcg).

## Debugging Errors
We understand that you may run into some errors while integrating our library. You can read more about our error messages [here](https://developer.flutterwave.com/docs/integration-guides/errors).
You can also follow us [@FlutterwaveEng](https://twitter.com/FlutterwaveEng) and let us know what you think 😊.

For `authorization` and `validation` error responses, double-check your API keys and request. If you get a `server` error, kindly engage the team for support.

<a id="support"></a>
## Support For additional assistance using this library, contact the developer experience (DX) team via [email](mailto:[email protected]) or on [slack](https://bit.ly/34Vkzcg).
## Contribution guidelines

You can also follow us [@FlutterwaveEng](https://twitter.com/FlutterwaveEng) and let us know what you think 😊
Read more about our community contribution guidelines [here](/CONTRIBUTING).

## Contribution guidelines
Read more about our community contribution guidelines [here](https://www.notion.so/flutterwavego/Community-contribution-guide-ca1d8a876ba04d45ab4b663c758ae42a).

## License
By contributing to the Flutter library, you agree that your contributions will be licensed under its [MIT license](https://opensource.org/licenses/MIT).

By contributing to the Flutter library, you agree that your contributions will be licensed under its [MIT license](/LICENSE).

Copyright (c) Flutterwave Inc.


## Built Using

- [flutter](https://flutter.dev/)
- [http](https://pub.dev/packages/http)
- [flutter_inappwebview](https://pub.dev/packages/flutter_inappwebview)
- [fluttertoast](https://pub.dev/packages/fluttertoast)

<a id="references"></a>
## Flutterwave API References

- [Flutterwave API Doc](https://developer.flutterwave.com/docs)
- [Flutterwave Inline Payment Doc](https://developer.flutterwave.com/docs/flutterwave-inline)
- [Flutterwave Dashboard](https://dashboard.flutterwave.com/login)
2 changes: 1 addition & 1 deletion lib/core/flutterwave.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Flutterwave {


/// Starts Standard Transaction
Future<ChargeResponse> charge() async {
Future<ChargeResponse?> charge() async {
final request = StandardRequest(
txRef: txRef,
amount: amount,
Expand Down