MNN-LLMMNN-LLM
Home
Get Started
Function Details
Supported Model IDs
Home
Get Started
Function Details
Supported Model IDs
  • Get Started

Get Started

pub package

LOGO

A Flutter Plugin for Android and IOS based on MNN-LLM.

AndroidiOS
SupportSDK 26+Not Supported

Getting Started

Add mnnllm as a dependency in your pubspec.yaml file.

dependencies:
  mnnllm: ^{{latest version}}

Replace latest version with the version number in badge above.

Runtime Screenshot

The example app running on Kirin 960 The example app running on Exynos 880

Usage

  1. Import Package.
import 'package:mnnllm/mnnllm.dart';
  1. Download Model.
await _mnnllmPlugin.downloadWithListen(modelID, listen: (state) {
      setState(() {
        downloadingState = state;
      });
    });
  1. Initialize Model.
int? val = await _mnnllmPlugin.initModel(
        modelID,
        _mnnllmPlugin.getModelName(modelID),
        configPath,
        _mnnllmPlugin.getSessionId(null),
        keepHistory: false
    );
  1. Generate Tokens.
_mnnllmPlugin.generateStreamAnswer(inputText,
            (data) { setState(() { generateText = data.toString(); }); },
            (err) { print(err.toString()); });

Warnings

  • The development for the iOS platform is still proceeding in pace.

RoadMap

  • Support for iOS platform
  • Support for text-to-image generation models
  • Support for multimodal large models

Contact Me

Liu liuzhi1999@foxmail.com

Last Updated:: 5/20/25, 5:25 PM
Contributors: liuzhi19121999