Byte recently opened the content output SDK, which allows you to insert novels and videos directly into your app. The plugin Flutter_Pangrowth was developed to allow readers to directly use bytes-provided novels, videos and other content in FLUTTER. Demo currently only supports novels. The warehouse address

instructions

To use Flutter_Pangrowth, you must first access the pangolin AD plugin Flutter_unionad, otherwise the ads cannot be displayed

Access to the document

  • Android

  • ios

The local environment

✓] Flutter (Channel stable, 2.5.0, on macOS 11.6 20G165 darwin-x64, ✓ ✓ Android toolchain-develop for Android Devices (Android SDK version 30.0.3) [✓] Xcode-develop Chrome - develop for the web [✓] Android Studio (version 2020.3) [✓] VS Code (version 1.60.1) [✓] Connected device (4 available)Copy the code

The integration steps

1, pubspec. Yaml

flutter_pangrowth: ^0.01.
/ / or

Copy the code

2, the introduction of

import 'package:flutter_pangrowth/flutter_pangrowth.dart';
Copy the code

use

1. SDK initialization

⚠️ Note: the initialization method with Flutter_unionad must be called before initializing the SDK, otherwise the AD cannot be loaded

await FlutterPangrowth.registerNovel(
      // The English name of the App connected to the novel SDK is mandatory
      appName: "appName".////This parameter is mandatory. Version name of SDKApp
      appVersionName: "1.0.0".// Access novel SDK App Version This parameter is mandatory
      appVersionCode: 1.// Channel number dimension of buried point upload. A developer's custom string is enough (it is recommended not to include test). optional
      channel: "test".////Appid required
      andoridAppId: "302043",
      iosAppId: "299886".// Whether to display logs
      debug: true,);Copy the code

2. Open the homepage of the novel

await FlutterPangrowth.openNovelPage();
Copy the code

3, NovelEntity instructions

{
    "code": 0.//1 succeeded 0 failed
    "msg": "".// Error message
    "data": [// Returns an array of novels
        {
            "bookId": "6806002909138914318"./ / novel id
            "bookName": "".// The name of the novel
            "readUrl": "".// Read the address
            "thumbUrl": "".// Cover of the novel
            "novelDetail": ""// The specific information of the novel is JSON (due to the different data formats of Android and ios, and the parameters required for the subsequent jump, etc., it is not processed to directly return JSON data, which can be interpreted by the developers in the project according to their needs)}}]Copy the code

4. Get a reading history

NovelEntity novel = await FlutterPangrowth.getNovelHistory();
Copy the code

5. Get the list of recommended books for startup

NovelEntity novel = await FlutterPangrowth.getNovelRecommendV1(
          size: 10.// Return the amount of data
        )
Copy the code

6. Get a list of recommended books from the Feed

NovelEntity novel = await FlutterPangrowth.getNovelRecommendFeed(
          size: 10.// Return the amount of data
        )
Copy the code

7, novel display report

await FlutterPangrowth.reportRecentNovelShow(
         type: result.type,// The type field in the NovelEntity
         book: result.novelDetail,//NovelEntity Specifies the novelDetail field in the NovelEntity
);
Copy the code

8. Open the novel page

await FlutterPangrowth.openNovelPageWithConfig(
  type: result.type,// The type field in the NovelEntity
  book: result.novelDetail,//NovelEntity Specifies the novelDetail field in the NovelEntity
);
Copy the code

9. Get the reading time for the day

Unit: millisecond

int _duration = await FlutterPangrowth.getReadDuration();
Copy the code

10, Get search Suggestion

NovelEntity novel = await FlutterPangrowth.searchNovelSuggestions(
          queryContent: query,// Search for the keyword
          offset: 1./ / page
          limit: 20.// Single time quantity
)
Copy the code

11, get search Results

NovelEntity novel = await FlutterPangrowth.searchNovelResults(
          queryContent: query,// Search for the keyword
          offset: 1./ / page
          limit: 20.// Single time quantity
)
Copy the code