Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to make this class work in a pure dart environment. #116

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AndreaNicola
Copy link

I had problems using this lib in a pure dart environment.

../../flutter/packages/flutter/lib/src/services/asset_bundle.dart:8:8: Error: Dart library 'dart:ui' is not available on this platform.
import 'dart:ui' as ui;
       ^
Context: The unavailable library 'dart:ui' is imported through these packages:

    server.dart => package:esc_pos_printer => package:esc_pos_utils => package:flutter => dart:ui
    ...

Detailed import paths for (some of) the these imports:

    server.dart => package:esc_pos_printer/esc_pos_printer.dart => package:esc_pos_printer/src/network_printer.dart => package:esc_pos_utils/esc_pos_utils.dart => package:esc_pos_utils/src/capability_profile.dart => package:flutter/services.dart => package:flutter/src/services/asset_bundle.dart => dart:ui
    server.dart => package:esc_pos_printer/esc_pos_printer.dart => package:esc_pos_printer/src/network_printer.dart => package:esc_pos_utils/esc_pos_utils.dart => package:esc_pos_utils/src/capability_profile.dart => package:flutter/services.dart => package:flutter/src/services/asset_bundle.dart => package:flutter/foundation.dart => package:flutter/src/foundation/assertions.dart => package:flutter/src/foundation/diagnostics.dart => package:flutter/src/foundation/debug.dart => dart:ui
    server.dart => package:esc_pos_printer/esc_pos_printer.dart => package:esc_pos_printer/src/network_printer.dart => package:esc_pos_utils/esc_pos_utils.dart => package:esc_pos_utils/src/capability_profile.dart => package:flutter/services.dart => package:flutter/src/services/asset_bundle.dart => package:flutter/foundation.dart => package:flutter/src/foundation/binding.dart => dart:ui
    server.dart => package:esc_pos_printer/esc_pos_printer.dart => package:esc_pos_printer/src/network_printer.dart => package:esc_pos_utils/esc_pos_utils.dart => package:esc_pos_utils/src/capability_profile.dart => package:flutter/services.dart => package:flutter/src/services/asset_bundle.dart => package:flutter/foundation.dart => package:flutter/src/foundation/binding.dart => package:flutter/src/foundation/assertions.dart => package:flutter/src/foundation/diagnostics.dart => package:flutter/src/foundation/debug.dart => dart:ui
    server.dart => package:esc_pos_printer/esc_pos_printer.dart => package:esc_pos_printer/src/network_printer.dart => package:esc_pos_utils/esc_pos_utils.dart => package:esc_pos_utils/src/capability_profile.dart => package:flutter/services.dart => package:flutter/src/services/asset_bundle.dart => package:flutter/foundation.dart => package:flutter/src/foundation/binding.dart => package:flutter/src/foundation/debug.dart => dart:ui
    server.dart => package:esc_pos_printer/esc_pos_printer.dart => package:esc_pos_printer/src/network_printer.dart => package:esc_pos_utils/esc_pos_utils.dart => package:esc_pos_utils/src/capability_profile.dart => package:flutter/services.dart => package:flutter/src/services/asset_bundle.dart => package:flutter/foundation.dart => package:flutter/src/foundation/change_notifier.dart => dart:ui
    server.dart => package:esc_pos_printer/esc_pos_printer.dart => package:esc_pos_printer/src/network_printer.dart => package:esc_pos_utils/esc_pos_utils.dart => package:esc_pos_utils/src/capability_profile.dart => package:flutter/services.dart => package:flutter/src/services/asset_bundle.dart => package:flutter/foundation.dart => package:flutter/src/foundation/change_notifier.dart => package:flutter/src/foundation/assertions.dart => package:flutter/src/foundation/diagnostics.dart => package:flutter/src/foundation/debug.dart => dart:ui
    server.dart => package:esc_pos_printer/esc_pos_printer.dart => package:esc_pos_printer/src/network_printer.dart => package:esc_pos_utils/esc_pos_utils.dart => package:esc_pos_utils/src/capability_profile.dart => package:flutter/services.dart => package:flutter/src/services/asset_bundle.dart => package:flutter/foundation.dart => package:flutter/src/foundation/change_notifier.dart => package:flutter/src/foundation/diagnostics.dart => package:flutter/src/foundation/debug.dart => dart:ui
    server.dart => package:esc_pos_printer/esc_pos_printer.dart => package:esc_pos_printer/src/network_printer.dart => package:esc_pos_utils/esc_pos_utils.dart => package:esc_pos_utils/src/capability_profile.dart => package:flutter/services.dart => package:flutter/src/services/asset_bundle.dart => package:flutter/foundation.dart => package:flutter/src/foundation/change_notifier.dart => package:flutter/src/foundation/memory_allocations.dart => dart:ui
    server.dart => package:esc_pos_printer/esc_pos_printer.dart => package:esc_pos_printer/src/network_printer.dart => package:esc_pos_utils/esc_pos_utils.dart => package:esc_pos_utils/src/capability_profile.dart => package:flutter/services.dart => package:flutter/src/services/asset_bundle.dart => package:flutter/foundation.dart => package:flutter/src/foundation/change_notifier.dart => package:flutter/src/foundation/memory_allocations.dart => package:flutter/src/foundation/assertions.dart => package:flutter/src/foundation/diagnostics.dart => package:flutter/src/foundation/debug.dart => dart:ui
    server.dart => package:esc_pos_printer/esc_pos_printer.dart => package:esc_pos_printer/src/network_printer.dart => package:esc_pos_utils/esc_pos_utils.dart => package:esc_pos_utils/src/capability_profile.dart => package:flutter/services.dart => package:flutter/src/services/asset_bundle.dart => package:flutter/foundation.dart => package:flutter/src/foundation/change_notifier.dart => package:flutter/src/foundation/memory_allocations.dart => package:flutter/src/foundation/diagnostics.dart => package:flutter/src/foundation/debug.dart => dart:ui
    server.dart => package:esc_pos_printer/esc_pos_printer.dart => package:esc_pos_printer/src/network_printer.dart => package:esc_pos_utils/esc_pos_utils.dart => package:esc_pos_utils/src/capability_profile.dart => package:flutter/services.dart => package:flutter/src/services/asset_bundle.dart => package:flutter/foundation.dart => package:flutter/src/foundation/debug.dart => dart:ui
    server.dart => package:esc_pos_printer/esc_pos_printer.dart => package:esc_pos_printer/src/network_printer.dart => package:esc_pos_utils/esc_pos_utils.dart => package:esc_pos_utils/src/capability_profile.dart => package:flutter/services.dart => package:flutter/src/services/asset_bundle.dart => package:flutter/foundation.dart => package:flutter/src/foundation/diagnostics.dart => package:flutter/src/foundation/debug.dart => dart:ui
    server.dart => package:esc_pos_printer/esc_pos_printer.dart => package:esc_pos_printer/src/network_printer.dart => package:esc_pos_utils/esc_pos_utils.dart => package:esc_pos_utils/src/capability_profile.dart => package:flutter/services.dart => package:flutter/src/services/asset_bundle.dart => package:flutter/foundation.dart => package:flutter/src/foundation/key.dart => package:flutter/src/foundation/diagnostics.dart => package:flutter/src/foundation/debug.dart => dart:ui
    server.dart => package:esc_pos_printer/esc_pos_printer.dart => package:esc_pos_printer/src/network_printer.dart => package:esc_pos_utils/esc_pos_utils.dart => package:esc_pos_utils/src/capability_profile.dart => package:flutter/services.dart => package:flutter/src/services/asset_bundle.dart => package:flutter/foundation.dart => package:flutter/src/foundation/memory_allocations.dart => dart:ui
    server.dart => package:esc_pos_printer/esc_pos_printer.dart => package:esc_pos_printer/src/network_printer.dart => package:esc_pos_utils/esc_pos_utils.dart => package:esc_pos_utils/src/capability_profile.dart => package:flutter/services.dart => package:flutter/src/services/asset_bundle.dart => package:flutter/foundation.dart => package:flutter/src/foundation/memory_allocations.dart => package:flutter/src/foundation/assertions.dart => package:flutter/src/foundation/diagnostics.dart => package:flutter/src/foundation/debug.dart => dart:ui
    server.dart => package:esc_pos_printer/esc_pos_printer.dart => package:esc_pos_printer/src/network_printer.dart => package:esc_pos_utils/esc_pos_utils.dart => package:esc_pos_utils/src/capability_profile.dart => package:flutter/services.dart => package:flutter/src/services/asset_bundle.dart => package:flutter/foundation.dart => package:flutter/src/foundation/memory_allocations.dart => package:flutter/src/foundation/diagnostics.dart => package:flutter/src/foundation/debug.dart => dart:ui
    server.dart => package:esc_pos_printer/esc_pos_printer.dart => package:esc_pos_printer/src/network_printer.dart => package:esc_pos_utils/esc_pos_utils.dart => package:esc_pos_utils/src/capability_profile.dart => package:flutter/services.dart => package:flutter/src/services/asset_bundle.dart => package:flutter/src/services/binding.dart => dart:ui
    server.dart => package:esc_pos_printer/esc_pos_printer.dart => package:esc_pos_printer/src/network_printer.dart => package:esc_pos_utils/esc_pos_utils.dart => package:esc_pos_utils/src/capability_profile.dart => package:flutter/services.dart => package:flutter/src/services/asset_bundle.dart => package:flutter/src/services/binding.dart => package:flutter/src/services/binary_messenger.dart => dart:ui
    server.dart => package:esc_pos_printer/esc_pos_printer.dart => package:esc_pos_printer/src/network_printer.dart => package:esc_pos_utils/esc_pos_utils.dart => package:esc_pos_utils/src/capability_profile.dart => package:flutter/services.dart => package:flutter/src/services/asset_bundle.dart => package:flutter/src/services/binding.dart => package:flutter/src/services/hardware_keyboard.dart => dart:ui
    server.dart => package:esc_pos_printer/esc_pos_printer.dart => package:esc_pos_printer/src/network_printer.dart => package:esc_pos_utils/esc_pos_utils.dart => package:esc_pos_utils/src/capability_profile.dart => package:flutter/services.dart => package:flutter/src/services/asset_bundle.dart => package:flutter/src/services/binding.dart => package:flutter/src/services/hardware_keyboard.dart => package:flutter/foundation.dart => package:flutter/src/foundation/assertions.dart => package:flutter/src/foundation/diagnostics.dart => package:flutter/src/foundation/debug.dart => dart:ui
    ...

../../flutter/packages/flutter/lib/src/services/asset_bundle.dart:15:1: Error: Dart library 'dart:ui' is not available on this platform.
export 'dart:ui' show ImmutableBuffer;
^
../../flutter/packages/flutter/lib/src/services/binary_messenger.dart:6:8: Error: Dart library 'dart:ui' is not available on this platform.
import 'dart:ui' as ui;
       ^
../../flutter/packages/flutter/lib/src/services/binary_messenger.dart:9:1: Error: Dart library 'dart:ui' is not available on this platform.
export 'dart:ui' show PlatformMessageResponseCallback;
^
../../flutter/packages/flutter/lib/src/services/binding.dart:8:8: Error: Dart library 'dart:ui' is not available on this platform.
import 'dart:ui' as ui;
       ^
../../flutter/packages/flutter/lib/src/services/binding.dart:22:1: Error: Dart library 'dart:ui' is not available on this platform.
export 'dart:ui' show ChannelBuffers, RootIsolateToken;
^
../../flutter/packages/flutter/lib/src/services/font_loader.dart:5:8: Error: Dart library 'dart:ui' is not available on this platform.
import 'dart:ui';
       ^
../../flutter/packages/flutter/lib/src/services/hardware_keyboard.dart:5:8: Error: Dart library 'dart:ui' is not available on this platform.
import 'dart:ui' as ui;
       ^
../../flutter/packages/flutter/lib/src/services/hardware_keyboard.dart:12:1: Error: Dart library 'dart:ui' is not available on this platform.
export 'dart:ui' show KeyData;
^

Process finished with exit code 254

The only fast workaround possible for me was transforming capabilities.json in a multiline string ad use it without the need to call:

image

and removing this import:

image

i hope this thing will help someone :-)

@AndreaNicola AndreaNicola changed the title Fix to make work this classes work in a pure dart environment. Fix to make this classes work in a pure dart environment. Jun 29, 2023
@AndreaNicola AndreaNicola changed the title Fix to make this classes work in a pure dart environment. Fix to make this class work in a pure dart environment. Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant