Plist parser - A Plist parser for Flutter supports XML and binary Apple Property list (plist) formats

Overview

Plist Parser for Flutter ๐Ÿ“‹

pub package

A Flutter Plugin for Plist parser supporting XML and Binary formats.

It's written xml and binary parser from scratch for Dart and this is not dependent other native libraries.

This was inspired by some libraries. please see below details.

Installation ๐Ÿ”ง

dependencies:
  plist_parser: "^0.0.1"

Usage ๐Ÿ•

import 'package:plist_parser/plist_parser.dart';
import 'dart:io';

const xml = '''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>string_type</key>
  <string>hello plist</string>
  <key>int_type</key>
  <integer>12345</integer>
  <key>double_type</key>
  <real>12.345</real>
  <key>bool_type_true</key>
  <true/>
  <key>bool_type_false</key>
  <false/>
  <key>date_type</key>
  <date>2022-02-11T18:27:45Z</date>
  <key>data_type</key>
  <data>VGVzdCBWYWx1ZQ==</data>
  <key>dict_type</key>
  <dict>
    <key>key1</key>
    <string>value1</string>
    <key>key2</key>
    <integer>2</integer>
    <key>long_key_item_name_aaaaa_bbbbb_ccccc_ddddd_eeeee</key>
    <string>long_key_item_value_11111_22222_33333_44444_55555</string>
  </dict>
  <key>array_type</key>
  <array>
    <string>array item1</string>
    <string>array item2</string>
  </array>
  <key>array_type2</key>
  <array>
    <string>array2 item1</string>
    <dict>
      <key>nest_array</key>
      <array>
        <string>nest_array_item</string>
      </array>
      <key>nest_dict</key>
      <dict>
        <key>nest_dict_item</key>
        <integer>12345</integer>
      </dict>
    </dict>
  </array>
</dict>
</plist>
''';

void main() {
  // parse from xml string
  var result = PlistParser().parse(xml);
  print(result);
  print("int_type: ${result["int_type"]}");
  print("array_type[1]: ${result["array_type"][1]}\n");

  // parse from binary file sync
  filePath = "${Directory.current.path}/example/example_binary.plist";
  print("parseBinaryFileSync\n${PlistParser().parseBinaryFileSync(filePath)}\n"); 
}

The output are these:

// โ€ป Formatted for readability
{
    string_type: hello plist, 
    int_type: 12345, 
    double_type: 12.345, 
    bool_type_true: true, 
    bool_type_false: false, 
    date_type: 2022-02-11 18:27:45.000Z, 
    data_type: Test Value, 
    dict_type: {
        key1: value1, 
        key2: 2, 
        long_key_item_name_aaaaa_bbbbb_ccccc_ddddd_eeeee: long_key_item_value_11111_22222_33333_44444_55555
    }, 
    array_type: [
        array item1, 
        array item2
    ], 
    array_type2: [
        array2 item1, 
        {
            nest_array: [nest_array_item], 
            nest_dict: {
                nest_dict_item: 12345
            }
        }
    ]
}

int_type: 12345
array_type item2: array item2

parseBinaryFileSync
{array_type2: [array2 item1, {nest_dict: {nest_dict_item: 12345}, nest_array: [nest_array_item]}], date_type: 2022-02-11 18:27:45.000, double_type: 12.345, string_type: hello plist, bool_type_true: false, array_type: [array item1, array item2], bool_type_false: true, dict_type: {key1: value1, key2: 2, long_key_item_name_aaaaa_bbbbb_ccccc_ddddd_eeeee: long_key_item_value_11111_22222_33333_44444_55555}, data_type: Test Value, int_type: 12345}

Other examples are stored in /example/plist_parser_example.dart

Inspiration โœจ

References ๐Ÿ’ก

You might also like...

Imports resource files as string or binary literals in Dart code.

resource_importer Imports resource files as string or binary literals in Dart code. What? resource_importer probably is best described with an example

Dec 3, 2022

Flutter widget library containing buttons for authenticating with popular social networks: Apple, Google, Facebook, Twitter and Microsoft.

Flutter widget library containing buttons for authenticating with popular social networks: Apple, Google, Facebook, Twitter and Microsoft.

Flutter Auth Buttons This library is now in maintenance mode I'm no longer actively using Flutter and don't have the time to keep this library maintai

Nov 3, 2022

[Flutter package] An easy and quick way to check if the local app is updated with the same version in their respective stores (Play Store / Apple Store ).

Retrieve version and url for local app update against store app Android and iOS Features Using as reference packages like in_app_update , version_chec

Nov 9, 2022

A loading more list which supports ListView,GridView,WaterfallFlow and Slivers.

loading_more_list A loading more list which supports ListView,GridView,WaterfallFlow and Slivers. Language: English | ไธญๆ–‡็ฎ€ไฝ“ Web demo for LoadingMoreLis

Dec 19, 2022

๐Ÿš— Apple CarPlay for Flutter Apps. Aims to make it safe to use apps made with Flutter in the car by integrating with CarPlay.

๐Ÿš— Apple CarPlay for Flutter Apps. Aims to make it safe to use apps made with Flutter in the car by integrating with CarPlay.

CarPlay with Flutter ๐Ÿš— Flutter Apps now on Apple CarPlay! flutter_carplay aims to make it safe to use iPhone apps made with Flutter in the car by int

Dec 26, 2022

A music player component for Flutter (i.e. Spotify, Apple Music, etc.) [AGPL/example/no longer maintaining]

A music player component for Flutter (i.e. Spotify, Apple Music, etc.) [AGPL/example/no longer maintaining]

This is an example I currently have no plans of putting this on Pub. Originally, I did, but I lost interest. However, I think this is a good example,

Dec 12, 2022

Authentication API client with Flutter (Login, Register, Google Login, Facebook Login, Apple Login)

Authentication API client with Flutter (Login, Register, Google Login, Facebook Login, Apple Login)

Flutter Auth App (Login, Register, Google Login, Facebook Login, Apple Login) To use this client, get the server up and running. Try it out now! App S

Jan 4, 2023

A lightweight flutter plugin to check if your app is up-to-date on Google Play Store or Apple App Store

App Version Checker this package is used to check if your app has a new version on playstore or apple app store. or you can even check what is the lat

Dec 14, 2022

A Flutter library for work with Apple Wallet passes.

A Flutter library for work with Apple Wallet passes.

pass-flutter A Flutter library for work with Apple Wallet passes. How use it Getting pass from URL to internal memory import 'package:pass_flutter/pas

Dec 30, 2022
Comments
  • Binary plist improvements

    Binary plist improvements

    • Fix error with int decoding
    • Validate binary plist version before parsing
    • Return binary data as Uint8List rather than as an invalid string (breaking change)
    • 30%+ performance improvement for binary parsing
    opened by Jon-Salmon 3
  • Please upgrade xml dependency

    Please upgrade xml dependency

    Hi Is it possible to upgrade xml dependency to the latest ? I'm using that xml dependency in my project, in addition to your parser. there is a huge performance improvement in xml package, it could be nice to be able to use it.

    Actually flutter complains about xml dependency in your package and does not allow to use latest xml package. Thanks Jerome

    opened by jeromeDms 2
Releases(v0.0.9)
Owner
dirablue ( gaku )
dirablue ( gaku )
Maps for Flutter developers. Supports Apple, Bing, and Google APIs.

Overview Cross-platform geographic maps for Flutter applications. Pull requests are welcome! The packages are licensed under the Apache License 2.0. P

Dint 17 Oct 13, 2022
Flutter library for Moyasar. Supports Apple Pay, STC Pay and Credit Card.

Flutter library for Moyasar. Supports Apple Pay, STC Pay and Credit Card.

null 12 Oct 22, 2022
Flutter package to create list of radio button, by providing a list of objects it can be a String list or list of Map.

Custom Radio Group List Flutter package to create list of radio button, by providing a list of objects it can be a String list or list of Map. Feature

Ashok Kumar Verma 0 Nov 30, 2021
Custom style-dictionary transforms and formats to generate Flutter resources from a Figma Design Token plugin export..

style-dictionary-figma-flutter An extension to style-dictionary to support more custom types with Flutter as target platform. It supports the custom t

Aloรฏs Deniel 24 Dec 30, 2022
(Top 10 GDG Devfest 2021) Mobile Application to prove intellectual property rights using blockchain technology and NFT

brainshield A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if t

Nguyen Minh Dung 4 Jan 12, 2022
Dart library for decoding/encoding image formats, and image processing.

image Overview A Dart library providing the ability to load, save and manipulate images in a variety of different file formats. The library is written

Brendan Duncan 907 Dec 27, 2022
Flutter RSS feed parsing - A demo application of flutter which parse RSS XML contents to the flutter application

Flutter RSS feed parsing demo This is demo application of flutter which shows ho

Nyakuri Levite 3 Nov 15, 2022
A Mobile application developed with Flutter and Dart to do math operations with binary numbers.

Math operations with Binary Numbers Readme PT About this Project Mobile application developed with Flutter and Dart to do math operations as sum, subt

Manoel Ribeiro 3 Nov 3, 2020
A library for parsing and encoding IEEE-754 binary floating point numbers.

Dart IEEE754 library This library provides decoding and transforming IEEE754 floating point numbers in binary format, double format, or as exponent an

null 0 Dec 24, 2021
Binary Decimal Converter with GetX

Conversor Binario Decimal con GetX En este ejemplo se usa la librerรญa GetX para implementar el convertor binario decimal Usamos: Dependecy injection h

null 0 Nov 27, 2021