amity_sdk 0.40.0 copy "amity_sdk: ^0.40.0" to clipboard
amity_sdk: ^0.40.0 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'))
          ],
        ),
      ),
    );
  }
}
14
likes
70
pub points
86%
popularity

Publisher

verified publisheramity.co

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

Homepage

Documentation

Documentation
API reference

License

unknown (LICENSE)

Dependencies

amity_sdk_api, byte_util, collection, dio, fixnum, flutter, freezed_annotation, get_it, hive, hive_flutter, mqtt_client, path_provider, socket_io_client, uuid

More

Packages that depend on amity_sdk