rayconnect_client 0.0.1-beta copy "rayconnect_client: ^0.0.1-beta" to clipboard
rayconnect_client: ^0.0.1-beta copied to clipboard

outdated

Rayconnect client on dart

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:rayconnect_client/main.dart';

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

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

class _MyAppState extends State<MyApp> {
  RayconnectClient rayconnectClient = new RayconnectClient(appId: 'test');

  @override
  void initState() {
    super.initState();
    this.init();
  }

  void init() async {
    if (await this.rayconnectClient.auth.hasToken() == false)
      await this.rayconnectClient.auth.asGuest();
    String token = await this.rayconnectClient.auth.getToken();
    print(token);
    String uid = await this.rayconnectClient.auth.getUserId();
    print(uid);

    bool status = await rayconnectClient.cloudStorage.setItem('name', 'Google');

    if (status == true)
      rayconnectClient.cloudStorage.getItem('name').then((data) => print(data));
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: FlatButton(
            child: Text('Do again'),
            onPressed: () => this.init(),
          ),
        ),
      ),
    );
  }
}
2
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Rayconnect client on dart

Homepage

License

unknown (license)

Dependencies

flutter, flutter_secure_storage, http

More

Packages that depend on rayconnect_client