flutter_rongim 0.0.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 39

flutter_rongim

A new Flutter plugin.

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

0.0.1

  • TODO: Describe initial release.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_rongim/flutter_rongim.dart';
import 'package:image_picker/image_picker.dart';

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

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

class _MyAppState extends State<MyApp> {
  String text = "11";
  String text2 = "22";
  String text3 = "33";
  String text4 = "44";
  String text5 = "55";
  String text6 = "66";

  setText(t) {
    setState(() {
      text = t;
    });
  }

  @override
  Widget build(BuildContext context) {
    FlutterRongim.setRCLogInfoListener().listen((ResultCallback callback) {
      print(callback.result);
    });
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('RongIm Plugin example app'),
        ),
        backgroundColor: Colors.white,
        body: ListView(
          children: <Widget>[
            Text(text),
            RaisedButton(
              onPressed: () {
                FlutterRongim.connect(
                        "DeXCHkAUCq1+/KnE2kcjPymK9zfNTKzs1o7YBRltabb7QpIqeYzw1SbscpOT3ksI32e6F0aOrcnSu/kvvmxEPQ==")
                    .then((ConnectCallback callback) {
                  setState(() {
                    if (callback.isSuccess) {
                      print(callback.toMap());
                      text = callback.toMap().toString();
                    } else {
                      print(callback.toMap());
                      text = callback.toMap().toString();
                    }
                  });
                });
              },
              child: Text("connect"),
            ),
            Text(text2),
            RaisedButton(
              onPressed: () {
                TextMessage content = TextMessage("test Text Message");
                Message message =
                    Message("chenpei2", ConversationType.PRIVATE, content);
                FlutterRongim.sendMessage(message)
                    .events.listen((ResultCallback<Message> callback) {
                  setState(() {
                    if (callback.isSuccess) {
                      print(callback.result.toMap().toString());
                      text2 = callback.result.toMap().toString();
                    } else {
                      print(callback.toMap().toString());
                      text2 = callback.toMap().toString();
                    }
                  });
                });
              },
              child: Text("sendMessage"),
            ),
            Text(text3),
            RaisedButton(
              onPressed: () {
                ImagePicker.pickImage(source: ImageSource.gallery).then((file) {
                  ImageMessage content = ImageMessage(
                      thumbUri: file.uri, localUri: file.uri, isFull: false);
                  Message message =
                      Message("chenpei2", ConversationType.PRIVATE, content);
                  FlutterRongim.sendImageMessage(message)
                      .events.listen((ResultCallback callback) {
                    setState(() {
                      if (callback.isSuccess) {
                        print(callback.result.toMap().toString());
                        text3 = callback.result.toMap().toString();
                      } else {
                        print(callback.toMap());
                        text3 = callback.toMap().toString();
                      }
                    });
                  });
                });
              },
              child: Text("pick-image"),
            ),
            Text(text4),
            RaisedButton(
              onPressed: () {
                ImagePicker.pickImage(source: ImageSource.gallery).then((file) {
                  FileMessage content = FileMessage(file.uri);
                  Message message =
                      Message("chenpei2", ConversationType.PRIVATE, content);
                  FlutterRongim.sendMediaMessage(message)
                      .events.listen((ResultCallback callback) {
                    setState(() {
                      if (callback.isSuccess) {
                        print(callback.result.toMap().toString());
                        text4 = callback.result.toMap().toString();
                      } else {
                        print(callback.toMap().toString());
                        text4 = callback.toMap().toString();
                      }
                    });
                  });
                });
              },
              child: Text("pick-file"),
            ),
            RaisedButton(
              onPressed: () {
                FlutterRongim.clearMessagesUnreadStatus(
                        "chenpei", ConversationType.PRIVATE)
                    .then((response) {});
              },
              child: Text("clearMessagesUnreadStatus"),
            ),
            Text(text5),
            RaisedButton(
              onPressed: () {
                FlutterRongim.getConversationList([ConversationType.PRIVATE])
                    .then((ResultCallback<List<Conversation>> callback) {
                  setState(() {
                    if (callback.isSuccess) {
                      print(callback.result);
                      text5 = callback.result
                          .map((conversation) => conversation.toMap())
                          .toList()
                          .toString();
                    } else {
                      print(callback.result.toString());
                      text5 = callback.result.toString();
                    }
                  });
                });
              },
              child: Text("getConversationList"),
            ),
            Text(text6),
            RaisedButton(
              onPressed: () {
                FlutterRongim.getHistoryMessages(
                        "chenpei2", ConversationType.PRIVATE, 0, 100)
                    .then((ResultCallback<List<Message>> callback) {
                  setState(() {
                    if (callback.isSuccess) {
                      print(callback.result);
                      text6 = callback.result
                          .map((message) => message.toMap())
                          .toList()
                          .toString();
                    } else {
                      print(callback.result.toString());
                      text6 = callback.result.toString();
                    }
                  });
                });
              },
              child: Text("getHistoryMessages"),
            ),
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_rongim: ^0.0.1

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:flutter_rongim/flutter_rongim.dart';
  
Version Uploaded Documentation Archive
0.0.1 Oct 8, 2018 Go to the documentation of flutter_rongim 0.0.1 Download flutter_rongim 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
84
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
39
Learn more about scoring.

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

  • Dart: 2.1.0
  • pana: 0.12.7
  • Flutter: 1.0.0

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs (-10 points)

291 out of 291 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

Fix lib/dao.dart. (-5 points)

Analysis of lib/dao.dart reported 1 warning:

line 701 col 1: This function has a return type of 'T', but doesn't end with a return statement.

Fix lib/flutter_rongim.dart. (-1 points)

Analysis of lib/flutter_rongim.dart reported 2 hints:

line 22 col 23: The value of the field '_channel_event' isn't used.

line 306 col 33: The value of the local variable 'result' isn't used.

Fix lib/send_message_task.dart. (-0.50 points)

Analysis of lib/send_message_task.dart reported 1 hint:

line 52 col 40: The value of the local variable '_completer' isn't used.

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Package is pre-v0.1 release. (-10 points)

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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.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