tobias 0.0.3

  • Example
  • Installing
  • Versions
  • new48



What's Tobias

Tobias is a flutter plugin for AliPaySDK.

Getting Started

I highly recommend that you read this article before using tobias. Tobias helps you to do something but not all. For example, you have to configure your URL Scheme on iOS.

Libraries Used In Tobias

We'd better know what tobias used. For Android:

    api files('libs/alipaySdk-20180601.jar')
    implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.60'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.24.0'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:0.24.0'

For iOS:

  s.dependency 'OpenAliPaySDK', '~> 15.5'

Add Tobias To pubspec.yaml

Add the following code in your pubspec.yaml:

  tobias: ^0.0.3


It's simple,pass Tobias your order info from server :

import 'package:tobias/tobias.dart' as tobias;

The result is map contains results from AliPay.The result also contains an external filed named platform which means the result is from iOS or android.

NOTE:Tobias use pay_V2.

For iOS,yout have to add url schema named alipay. On Xcode GUI: url_schema

in your info.plist:


You can also call tobias.version() which returns a map contains version and platform.


Copyright 2018 OpenFlutter Project

Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements.  See the NOTICE file distributed with this work for
additional information regarding copyright ownership.  The ASF licenses this
file to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License.  You may obtain a copy of
the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
License for the specific language governing permissions and limitations under
the License.


  • 删除AliPayModel


  • 修复iOS支付bug


  • first released.


import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:tobias/tobias.dart' as tobias;

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  _MyAppState createState() => new _MyAppState();

class _MyAppState extends State<MyApp> {
  String _payInfo = "";
  Map _payResult;

  final myController = new TextEditingController();

  void _loadData() {
    _payInfo = "";
    _payResult = {};

            body: json.encode({"fee": 1, "title": "test pay"}))
        .then((http.Response response) {
      if (response.statusCode == 200) {
        var map = json.decode(response.body);
        int flag = map["flag"];
        if (flag == 0) {
          var result = map["result"];
          setState(() {
            _payInfo = result["credential"]["payInfo"];
            myController.text = _payInfo;
      throw new Exception("创建订单失败");
    }).catchError((e) {
      setState(() {
        _payInfo = e.toString();
        myController.text = _payInfo;

    setState(() {});

  initState() {


  onChanged(String value) {
    _payInfo = value;

  callAlipay() async {
    Map payResult;
    try {
      print("The pay info is : " + _payInfo);
      payResult = await;
    } on Exception catch (e) {
      payResult = {};

    if (!mounted) return;

    setState(() {
      _payResult = payResult;

  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Tobias example'),
        body: new SingleChildScrollView(
          child: new Column(
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[
              new Text("input order info"),
              new TextField(
                  maxLines: 15, onChanged: onChanged, controller: myController),
              new RaisedButton(onPressed: callAlipay, child: new Text("pay")),
              new RaisedButton(
                  onPressed: () {
                  child: new Text("reopen an order")),
              new Text(_payResult == null ? "" : _payResult.toString())

Use this package as a library

1. Depend on it

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

  tobias: ^0.0.3

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:

import 'package:tobias/tobias.dart';
Version Uploaded Documentation Archive
0.0.3 Sep 8, 2018 Go to the documentation of tobias 0.0.3 Download tobias 0.0.3 archive
0.0.2 Sep 7, 2018 Go to the documentation of tobias 0.0.2 Download tobias 0.0.2 archive
0.0.1 Sep 5, 2018 Go to the documentation of tobias 0.0.1 Download tobias 0.0.1 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Sep 18, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.3
  • Flutter: 0.8.4


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.


Package is pre-v0.1 release.

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


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.58.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8