Open riccardocalligaro opened 4 years ago
Can you try the prerelease ?
Since I updated the way the tree behaves, it may be better now.
Same issue for me. Tried prerelease version but it falis with:
../../../../../../.pub-cache/hosted/pub.dartlang.org/device_preview-0.5.0-prerelease.4/lib/src/tool_bar/format.dart:4:8: Error: Error when reading '../../../../../../.pub-cache/hosted/pub.dartlang.org/meta-1.1.8/lib/meta_meta.dart': No such file or directory
import 'package:meta/meta_meta.dart';
^
../../../../../../.pub-cache/hosted/pub.dartlang.org/device_preview-0.5.0-prerelease.4/lib/src/tool_bar/menus/devices.dart:157:25: Error: Getter not found: 'phonelink_setup_outlined'.
icon: Icons.phonelink_setup_outlined,
^^^^^^^^^^^^^^^^^^^^^^^^
It seems like an environment problem on your side.
Which version of flutter do you use ? Can you run a flutter clean
?
(I published a new prerelease version).
@aloisdeniel I experimented a bit more and fount out what caused this error. Before running the app we initialized date formatting with initializeDateFormatting('ru_RU').then((_) => runApp(...)
from intl
package. If I remove this line then your library works without an error. However I would still like to be able to use initializeDateFormatting 🤔
Using Flutter 1.22
UPD: I moved initializeDateFormatting('ru_RU')
call into a builder of DevicePreview and it's all working now. I was a bit afraid that I should only start my app after initializeDateFormatting resolved it's Future
, but turns out that this method is actually synchronous and only returns new Future.value(null)
for some weird reason.
So this set up helped me fix the issue:
runApp(DevicePreview(
enabled: !kReleaseMode,
availablesLocales: [NamedLocale('ru', 'RU')],
builder: (context) {
initializeDateFormatting('ru_RU');
return MyApp();
}));
Same issue for me. Tried prerelease version but it falis with:
../../../../../../.pub-cache/hosted/pub.dartlang.org/device_preview-0.5.0-prerelease.4/lib/src/tool_bar/format.dart:4:8: Error: Error when reading '../../../../../../.pub-cache/hosted/pub.dartlang.org/meta-1.1.8/lib/meta_meta.dart': No such file or directory import 'package:meta/meta_meta.dart'; ^ ../../../../../../.pub-cache/hosted/pub.dartlang.org/device_preview-0.5.0-prerelease.4/lib/src/tool_bar/menus/devices.dart:157:25: Error: Getter not found: 'phonelink_setup_outlined'. icon: Icons.phonelink_setup_outlined, ^^^^^^^^^^^^^^^^^^^^^^^^
same issues , any update please
same issue
Same issue
got the same error.
found out that it only occurs when I'm using this method here from the "intl"-package somewhere in my code (directly or any package that uses it):
initializeDateFormatting('de_DE');
and I need to use this method when working with non-english Locales (in my case for formatting dates)
and the initiator of this issue @riccardocalligaro is also using the "intl" package, so it seems that it's the same problem
This is the Stacktrace i get:
The following UnsupportedError was thrown building Positioned(left: 0.0, top: 0.0, right: 0.0, bottom: 0.0):
Unsupported operation: Cannot modify unmodifiable map
The relevant error-causing widget was:
Positioned Positioned:file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/device_preview-1.0.0/lib/src/device_preview.dart:599:36
When the exception was thrown, this was the stack:
#0 _UnmodifiableMapMixin.[]= (dart:collection/maps.dart:269:5)
#1 initializeDateFormattingCustom (package:intl/date_symbol_data_custom.dart:35:19)
and this is the most basic example for reproduction:
import 'package:device_preview/device_preview.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:intl/intl.dart';
void main() => runApp(
DevicePreview(
enabled: !kReleaseMode,
builder: (context) => MyApp(), // Wrap your app
),
);
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
initializeDateFormatting('de_DE');
return MaterialApp(
useInheritedMediaQuery: true,
locale: DevicePreview.locale(context),
builder: DevicePreview.appBuilder,
home: MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
children: [
Text('${DateFormat('E, dd.MM.yyyy', 'en_US').format(DateTime.now())}'),
Text('${DateFormat('E, dd.MM.yyyy', 'de_DE').format(DateTime.now())}')
],
),
),
);
}
}
@aloisdeniel is that something you can fix on your side?
I am still facing this issue using the current 1.0.0 . How did you guys fixed this?
by not using the 'intl' package
@filly82 but then how do you configure the intl package?
when you don't use it then you don't need to configure it :)
in my case it was following method that caused the problem, so I don't use it anymore
initializeDateFormatting();
in your case it could be another method from the package that is causing the error.
@sawirricardo look at @makstheimba post for a temporary fix if you are using the intl-package directly
in my case that is not possible, because i am not using the package directly, I use another package that uses the intl-package
@filly82 , I used it directly, though. But it's true that if I take out the initializeDateFormatting()
, the app compiles successfully. But, it seems not a good fix.
@sawirricardo Have you read the post from @makstheimba completely? No need to take the method out, you have to relocate it
@filly82 Done that, but no luck. It still errs due to either "directionality" widget or Positioned widget. Both of them under error Unsupported operation: Cannot set value in unmodifiable Map
.
Removing the initializeDateFormatting fixed the problem in my case
I'm still encountering this issue. The fix from @makstheimba worked for the time being.
Same issue here. Exaclty what described before. Using Intl package throw that error. Any updates?
Version: 0.4.8
Stacktrace
Flutter doctor