A Flutter plugin for reading and writing mp3 file tags.


First get the filepath from an mp3 file saved on the device. If you have the mp3 file in your flutter assets, you can save it to the device like so:

import 'package:path_provider/path_provider.dart';
String filepath;

writeToFile(ByteData data, String path) {
  final buffer = data.buffer;
  return new File(path).writeAsBytes(
    buffer.asUint8List(data.offsetInBytes, data.lengthInBytes)

Future<void> getFilepath() async {
    String dir = (await getApplicationDocumentsDirectory()).path;
    if (!(File(dir + "/track.mp3").existsSync())) {
      var bytes = await rootBundle.load("mp3samples/track.mp3");
      await writeToFile(bytes, dir + "/track.mp3");
    filepath = dir + "/track.mp3";

To read specific tags:

Future<String> title = Mp3editor.getTitle(filepath);
Future<String> artist = Mp3editor.getArtist(filepath);
Future<String> trackNumber = Mp3editor.getTrackNumber(filepath);
Future<String> album = Mp3editor.getAlbum(filepath);
Future<String> year = Mp3editor.getYear(filepath);
Future<String> genre = Mp3editor.getGenre(filepath);
Future<String> comment = Mp3editor.getComment(filepath);

Method will return null if tag is empty.

To write tags, you will need overwrite all the existing tags in the file:

  filepath: filepath,
  title: 'Title',
  artist: 'Artist',
  album: 'Album',
  year: '2019',
  genre: 52,
  comment: 'Comment'

Be careful with the 'genre' parameter, you need to specify an ID3v1 genre number, see this for more.

Checkout the example for further details.

Getting Started

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.