0

I have a Flutter project that previously used the flutter_adaptive_cards package to render Microsoft Adaptive Cards. The old code looked something like this:

final AdaptiveCard adaptiveCard = AdaptiveCard.memory(
  content: json.decode(
    attachment.content!
      .replaceAll(RegExp(r'"height"\s*:\s*"auto"'), '''"height" : null''')
      .replaceAll(RegExp(r'"width"\s*:\s*"auto"'), '''"width" : null''')
  ),
  hostConfigPath: 'lib/host_config',
  showDebugJson: false,
);

However, flutter_adaptive_cards is now outdated and is no longer maintained. I’ve tried replacing it with adaptive_card_renderer (or other newer packages), but I’m facing issues:

  • Some classes and methods (AdaptiveCard, .memory(), hostConfigPath) no longer exist in the new package.

  • I can’t find clear documentation or migration guides for converting existing code.

  • My app needs to dynamically render Adaptive Cards from JSON strings (coming from Microsoft Graph API messages).

Question: What is the best currently maintained Flutter package for rendering Adaptive Cards, and how can I rewrite the above flutter_adaptive_cards code to work with it? Ideally, I’d like:

1 Answer 1

0

Answer (worked for me):

I replaced flutter_adaptive_cards with adaptive_card_renderer: ^1.0.1 and it’s been working well on Flutter 3.29 / Dart 3.7.

dependencies:
  adaptive_card_renderer: ^1.0.1
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.