tizen_bundle 0.1.2 copy "tizen_bundle: ^0.1.2" to clipboard
tizen_bundle: ^0.1.2 copied to clipboard

Tizen data bundle APIs.

tizen_bundle #

pub package

Tizen Data Bundle APIs.

Usage #

To use this package, add tizen_bundle as a dependency in your pubspec.yaml file.

depenedencies:
  tizen_bundle: ^0.1.2
copied to clipboard

Adding content to a bundle #

The bundle content is in the form of key-value pairs. The key is always a String. The value must be either a String, a List<String>, or a Uint8List.

Bundles can be treated like a Map. You can use the [] operator or Bundle.addAll() to add data to a bundle.

import 'package:tizen_bundle/tizen_bundle.dart';

var bundle = Bundle();
bundle['string'] = 'value';
bundle['strings'] = <String>['value1', 'value2', 'value3'];
bundle['bytes'] = Uint8List.fromList(<int>[0x01, 0x02, 0x03]);
copied to clipboard

Accessing the bundle content #

To get data from a bundle or update their values, use the [] operator.

var stringValue = bundle['string'];
if (stringValue is String) {
  // The value is a string.
}

var stringsValue = bundle['strings'];
if (stringsValue is List<String>) {
  // The value is a string list.
}

var bytesValue = bundle['bytes'];
if (bytesValue is Uint8List) {
  // The value is a byte list.
}
copied to clipboard

You can also use other methods and properties supported by a Map, such as containsKey and remove.

if (bundle.containsKey('string')) {
  bundle.remove('string');
}
copied to clipboard

Encoding and decoding a bundle #

To save bundle data to a file or send over network, you can encode them to a raw string using Bundle.encode(). To restore the bundle from the encoded string, use Bundle.decode().

var bundle = Bundle();
bundle['key'] = 'value';

var encoded = bundle.encode();
var newBundle = Bundle.decode(encoded);
copied to clipboard
0
likes
140
points
240
downloads

Publisher

verified publishertizen.org

Weekly Downloads

2024.09.13 - 2025.03.28

Tizen data bundle APIs.

Homepage
Repository (GitHub)

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

ffi, flutter, tizen_interop

More

Packages that depend on tizen_bundle