flutterflare

How to solve format exception with flare?


I'm using flare but I get this error, error goes away when I use CircularProgressIndicator().

[ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: FormatException: Unexpected character (at character 1)
E/flutter ( 7668): PK

Here's the code:

import 'package:flutter/material.dart';
import 'package:flare_flutter/flare_actor.dart';

class LoadingIndicator extends StatelessWidget {
  Widget build(BuildContext context) {
    return Center(
      // child: CircularProgressIndicator(),
      child: FlareActor(
        "assets/loading_1.flr2d",
        alignment: Alignment.center,
        fit: BoxFit.contain,
        animation: "loading",
      ),
    );
  }
}

SOLUTION

When I've downloaded Flare graphics from Explore page of 2Dimensions, I was downloading .flr2d files. Which was I guess a project fiel. In flare, you have to export rather than download. I've exported as binary and the output file has .flr extension. Thanks @Noob for helping me to find the answer.


Solution

  • Flutter only supports .flr and not .flr2d

    I know this because I was running into the same issue.

    The animation needs to be created into an flr file otherwise you will always run into this error.