amity_sdk 0.54.0-beta.8 copy "amity_sdk: ^0.54.0-beta.8" to clipboard
amity_sdk: ^0.54.0-beta.8 copied to clipboard

The SDK that enables social features such as Feeds, Groups, Profiles, Content Posts, and Social Media Type Interactions

example/lib/main.dart

import 'package:amity_sdk/amity_sdk.dart';
import 'package:flutter/material.dart';

void main() async {
  ///Setup Amity Core client with [apikey] and the region you want to connect with
  ///
  ///By default AmityCoreClient will connect to AmityRegionalHttpEndpoint.SG.
  ///If you want to change the region you can do so by passing httpEndpoint parameter:
  await AmityCoreClient.setup(
      option: AmityCoreClientOption(
          apiKey: 'apiKey', httpEndpoint: AmityRegionalHttpEndpoint.SG));
  runApp(const AmitySocialSdk());
}

class AmitySocialSdk extends StatelessWidget {
  const AmitySocialSdk({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Amity Social Sdk Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const HomeScreen(title: 'Flutter Demo Home Page'),
    );
  }
}

class HomeScreen extends StatefulWidget {
  const HomeScreen({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<HomeScreen> createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'Here is the Login Example with Amity Social SDK',
            ),
            ElevatedButton(
                onPressed: () {
                  ///Login the user with user id and display name
                  ///
                  ///this will create the session for the logged in user
                  AmityCoreClient.login('userId')
                      .displayName('userDisplayName')
                      .submit();
                },
                child: const Text('Login'))
          ],
        ),
      ),
    );
  }
}
17
likes
0
points
2.34k
downloads

Publisher

verified publisheramity.co

Weekly Downloads

The SDK that enables social features such as Feeds, Groups, Profiles, Content Posts, and Social Media Type Interactions

Homepage

Documentation

Documentation

License

unknown (license)

Dependencies

amity_sdk_api, build_runner, byte_util, collection, device_info_plus, dio, fixnum, flutter, freezed_annotation, frontend_server_client, get_it, hive, hive_flutter, mqtt_client, path_provider, socket_io_client, uuid, win32

More

Packages that depend on amity_sdk