byte_array 0.1.6

byte_array #

Byte array manipulation modelled after AS3 ByteArray class. https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/utils/ByteArray.html

Usage #

A simple usage example:

import 'package:byte_array/byte_array.dart';

main() {
  final bytes = ByteArray(6);
  bytes.writeFloat(33.6);
  bytes.writeUnsignedShort(5);

  print('length in bytes: ${bytes.length}');

  bytes.offset = 0;
  final float = bytes.readFloat();
  print(float);

  final short = bytes.readUnsignedShort();
  print(short);
}

Changelog #

0.1.5 #

  • Use generic functions
  • Use implicit-casts: false lint

0.1.4 #

  • Update for Dart 2

0.0.1 #

  • Initial version, created by Stagehand

example/byte_array_example.dart

import 'package:byte_array/byte_array.dart';

void main() {
  final bytes = ByteArray(6);
  bytes.writeFloat(33.6);
  bytes.writeUnsignedShort(5);

  print('length in bytes: ${bytes.length}');

  bytes.offset = 0;
  final float = bytes.readFloat();
  print(float);

  final short = bytes.readUnsignedShort();
  print(short);
}

Use this package as a library

1. Depend on it

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


dependencies:
  byte_array: ^0.1.6

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:byte_array/byte_array.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
54
Health:
Code health derived from static analysis. [more]
96
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
76
Learn more about scoring.

We analyzed this package on Jul 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:byte_array/byte_array.dart.

Health suggestions

Fix lib/src/byte_array_base.dart. (-3.93 points)

Analysis of lib/src/byte_array_base.dart reported 8 hints, including:

line 20 col 24: Don't explicitly initialize variables to null.

line 78 col 29: DO use curly braces for all flow control structures.

line 92 col 38: DO use curly braces for all flow control structures.

line 106 col 7: DO use curly braces for all flow control structures.

line 128 col 7: DO use curly braces for all flow control structures.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
typed_data >=1.1.3 <2.0.0 1.1.6
Dev dependencies
test ^1.3.0

Admin