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

Error when access property of a Map. #52

Open
tannguyen3489 opened this issue Apr 6, 2023 · 0 comments
Open

Error when access property of a Map. #52

tannguyen3489 opened this issue Apr 6, 2023 · 0 comments

Comments

@tannguyen3489
Copy link

hi @team,

I have an issue with Map type

library hot_update;

import 'dart:convert';

import 'package:eval_annotation/eval_annotation.dart';
import 'package:flutter/material.dart';

@RuntimeOverride('#myapp_main_scaffold_1')
// ignore: no_leading_underscores_for_local_identifiers
Widget scaffoldUpdate(BuildContext context, int counter, void Function() _incrementCounter) {

  Map testData = {
    "address": "address",
    "email": "[email protected]",
    "fax": "+123",
    "faxCountryDial": "123123123",
    "phoneCountryDial": "+123",
    "phone": "123123123",
  };

  String encode = json.encode(testData);
  Map<String, dynamic> decodeData = json.decode(encode);

  return Scaffold(
    appBar: AppBar(
      title: const Text("Time counter"),
      backgroundColor: Colors.indigo,
    ),
    body: Center(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          Text(
            'You have added this many seconds 123: ${decodeData["email"]}',
          ),
          Text(
            '$counter',
            style: Theme.of(context).textTheme.headlineMedium,
          ),
        ],
      ),
    ),
    floatingActionButton: FloatingActionButton(
      onPressed: _incrementCounter,
      tooltip: 'Increment',
      child: const Icon(Icons.access_time_filled),
    ),
  );
}

image

when load this widget to HotSwap widget, it will throw error. Please tell me how to fix this issue with Map type.

test2

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

No branches or pull requests

1 participant