Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve format exception with flare?

Tags:

flutter

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.

like image 261
mirkancal Avatar asked Jun 27 '19 15:06

mirkancal


1 Answers

As Noob mentioned your file needs to be a .flr

If you are downloading from 2 dimension's page then you need to go to Export at top right from Flare editor. Then select file format as JSON not binary. You should be then downloading the asset as a .flr file.

like image 61
Shababb Karim Avatar answered Sep 18 '22 18:09

Shababb Karim