Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
488 views
in Technique[技术] by (71.8m points)

dart - How to solve mirror class error in flutter?

I have been searching for a solution for this error for two days now

'type 'MethodMirrorImpl' is not a subtype of type 'VariableMirror'

in my flutter application but I can't get any solution.

here is my code:

My function:

final DataQueryBuilder queryBuilder = DataQueryBuilder();
  Future<List<dynamic>> getData() async {
    queryBuilder.pageSize = 50;

    try {
      final list = await Backendless.data.withClass<Movie>().find(queryBuilder);
      return list;
    }
    catch (e) {
      print(e);
    }
    return [];
  }

My Model class:

@reflector
class Movie{

  String _name;
  String _type;
  String _channel;
  String _day;
  String _hour;
  String _minutes;
  String _ampm;
  String _url;
  String _plot;

  String get name => _name;

  String get type => _type;

  String get plot => _plot;

  String get url => _url;

  String get ampm => _ampm;

  String get minutes => _minutes;

  String get hour => _hour;

  String get day => _day;

  String get channel => _channel;

}

My main configuration:

import 'package:flutter/material.dart';
import 'package:newtest/provider/MoviesProvider.dart';
import 'package:newtest/widgets/containers.dart';
import 'package:backendless_sdk/backendless_sdk.dart';
import 'package:provider/provider.dart';
import 'main.reflectable.dart';

void main() {
  initializeReflectable();
  runApp(MyApp());
}

class MyApp extends StatelessWidget {


  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: ChangeNotifierProvider<MoviesProvider>(
        create: (_)=> MoviesProvider(),
        child: MyHomePage(title: 'Flutter Demo Home Page'),
      )
    );
  }

}


class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}


class _MyHomePageState extends State<MyHomePage> {

  @override
  void initState() {
    super.initState();
    Backendless.initApp("appId", "androidId", "iosId");
  }

.................................................... ................................................... ..........

question from:https://stackoverflow.com/questions/65944512/how-to-solve-mirror-class-error-in-flutter

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...