backendless_sdk 6.3.2 copy "backendless_sdk: ^6.3.2" to clipboard
backendless_sdk: ^6.3.2 copied to clipboard

outdated

Flutter plugin for Backendless SDK. It provides access to the Backendless services that enable the server-side functionality for developing and running mobile and desktop apps.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:backendless_sdk/backendless_sdk.dart';
import 'package:google_sign_in/google_sign_in.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  static const String APP_ID = "848B6DEE-6115-418A-A98D-BFACA11F6202";
  static const String ANDROID_KEY = "C6DA90F0-21A0-4BD0-9A24-F050BEEC3551";
  static const String IOS_KEY = "YOUR_IOS_KEY";

  GoogleSignIn _googleSignIn = GoogleSignIn(
    clientId:
        '558775327925-l37npuo7p203j82jrg9ec828cb0ppt3b.apps.googleusercontent.com',
    scopes: <String>[
      'email',
      'https://www.googleapis.com/auth/contacts.readonly',
    ],
  );

  @override
  void initState() {
    super.initState();
    Backendless.initApp(APP_ID, ANDROID_KEY, IOS_KEY);
  }

  BackendlessUser guest;

  void buttonPressed() async {
    guest = await Backendless.userService.loginAsGuest();

    GoogleSignInAccount googleSignInAccount =
        await _googleSignIn.signIn(); //pass ok

    GoogleSignInAuthentication googleSignInAuthentication =
        await googleSignInAccount.authentication; //pass ok

    BackendlessUser be = await Backendless.userService.loginWithOauth2(
        "googleplus",
        googleSignInAuthentication.accessToken,
        {"email": "email"},
        true,
        guest);
    print("BACKENDLESS USER: $be");
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
            child: Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            ElevatedButton(child: Text("Press"), onPressed: buttonPressed)
          ],
        )),
      ),
    );
  }
}
46
likes
0
pub points
80%
popularity

Publisher

unverified uploader

Flutter plugin for Backendless SDK. It provides access to the Backendless services that enable the server-side functionality for developing and running mobile and desktop apps.

Homepage

License

unknown (LICENSE)

Dependencies

collection, flutter, flutter_web_plugins, http, js, reflectable

More

Packages that depend on backendless_sdk