metadata 1.0.2 copy "metadata: ^1.0.2" to clipboard
metadata: ^1.0.2 copied to clipboard

outdated

metadata helps to extract metadata from your files.

metadata #

Platform Pub Package License: MIT Donate Issue Forks Stars

metadata is a dart library to extract exif data of the images. It is purely written in dart, So it can be used on server as well as on client.

Table of Contents #

Lets Get Started #

1. Depend on it #

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

dependencies:
  metadata: ^1.0.2

2. Install it #

You can install packages from the command line:

with pub:

$  pub get

3. Import it #

Now in your Dart code, you can use:

    import 'package:metadata/metadata.dart';

Usage #

Imports #

    import 'package:metadata/metadata.dart';
    

Read Image File #

    var file = "path_to_pre_existing_image_file/image.jpg";
    var bytes = File(file).readAsBytesSync();
    

Read Image from Flutter's Asset Folder #

    import 'package:flutter/services.dart' show ByteData, rootBundle;
    
    /* Your blah blah code here */
    
    ByteData data = await rootBundle.load("assets/path_to_pre_existing_image_file/image.jpg";);
    var bytes = data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);
    

Extract Exif Data #

    var result = MetaData.exifData(bytes);
    if (result.error == null) {
      var content = result.exifData; // exif data is available in contents
      saveFile(image_name, content);
    } else {
      print('File: $image.jpg, Error: ${result.error}');
    }
    

Extract Exif Data with callback #

    MetaData.exifData(bytes, onValue: (CallBack result) {
      if (result.error == null) {
        var content = result.exifData;
        saveFile(image_name, content);
      } else {
        print('File: $image.jpg, Error: ${result.error}');
      }
    });
    

Extract XMP Data #

    var mapResult = MetaData.extractXMP(bytes);
    print(mapResult.toString());
    saveFile(image_name, mapResult);
    

Saving exif content into File #

      void saveFile(String fileName, dynamic exifContent) {
          File('${path}$fileName.json').writeAsStringSync(jsonEncode(exifContent));
      }
    

Features coming in next version #

On-going implementation for future:

  • metadata of audio and video files
  • extracting file-types

Also checkout our other libraries:

Ooooops, My laptop is slow, but I'm not.

  • Paypal
  • Not having Paypal account ?? Join Now and both of us could earn $10
15
likes
40
points
62
downloads

Publisher

verified publisherjustkawal.dev

Weekly Downloads

metadata helps to extract metadata from your files.

Repository (GitHub)

License

MIT (license)

Dependencies

xmp

More

Packages that depend on metadata