bhoominn / nb_utils Goto Github PK
View Code? Open in Web Editor NEWCollection of Widgets and helpful Methods that every developer needs.
Home Page: https://pub.dev/packages/nb_utils
License: MIT License
Collection of Widgets and helpful Methods that every developer needs.
Home Page: https://pub.dev/packages/nb_utils
License: MIT License
The image_editor_plus: ^0.1.3
package in our project, is using the latest version of nb_utils: 4.5.1
.
Our Flutter project's environment sdk contraints are:
environment:
sdk: ">=2.16.2 <3.0.0"
When building the app for Android, the build fails with the following error:
../../Flutter%20SDK/Flutter%20Git%20Repository/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.5.1/lib/src/utils/common.dart:200:29: Error: Method 'addPostFrameCallback' cannot be called on 'SchedulerBinding?' because it is potentially null.
- 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('../../Flutter%20SDK/Flutter%20Git%20Repository/flutter/packages/flutter/lib/src/scheduler/binding.dart').
Try calling using ?. instead.
SchedulerBinding.instance.addPostFrameCallback((_) => onCreated?.call());
^^^^^^^^^^^^^^^^^^^^
../../Flutter%20SDK/Flutter%20Git%20Repository/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.5.1/lib/src/utils/after_layout.dart:12:10: Error: Method 'addPostFrameCallback' cannot be called on 'WidgetsBinding?' because it is potentially null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../Flutter%20SDK/Flutter%20Git%20Repository/flutter/packages/flutter/lib/src/widgets/binding.dart').
Try calling using ?. instead.
.addPostFrameCallback((_) => afterFirstLayout(context));
^^^^^^^^^^^^^^^^^^^^
../../Flutter%20SDK/Flutter%20Git%20Repository/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.5.1/lib/src/widgets/OverlayCustomWidget.dart:59:31: Error: Method 'addPostFrameCallback' cannot be called on 'WidgetsBinding?' because it is potentially null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../Flutter%20SDK/Flutter%20Git%20Repository/flutter/packages/flutter/lib/src/widgets/binding.dart').
Try calling using ?. instead.
WidgetsBinding.instance.addPostFrameCallback((_) => showOverlay());
^^^^^^^^^^^^^^^^^^^^
../../Flutter%20SDK/Flutter%20Git%20Repository/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.5.1/lib/src/widgets/OverlayCustomWidget.dart:66:29: Error: Method 'addPostFrameCallback' cannot be called on 'WidgetsBinding?' because it is potentially null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../Flutter%20SDK/Flutter%20Git%20Repository/flutter/packages/flutter/lib/src/widgets/binding.dart').
Try calling using ?. instead.
WidgetsBinding.instance.addPostFrameCallback((_) => syncWidgetAndOverlay());
^^^^^^^^^^^^^^^^^^^^
../../Flutter%20SDK/Flutter%20Git%20Repository/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.5.1/lib/src/widgets/OverlayCustomWidget.dart:72:29: Error: Method 'addPostFrameCallback' cannot be called on 'WidgetsBinding?' because it is potentially null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../Flutter%20SDK/Flutter%20Git%20Repository/flutter/packages/flutter/lib/src/widgets/binding.dart').
Try calling using ?. instead.
WidgetsBinding.instance.addPostFrameCallback((_) => syncWidgetAndOverlay());
^^^^^^^^^^^^^^^^^^^^
../../Flutter%20SDK/Flutter%20Git%20Repository/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.5.1/lib/src/widgets/TimerWidget.dart:44:29: Error: Method 'addObserver' cannot be called on 'WidgetsBinding?' because it is potentially null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../Flutter%20SDK/Flutter%20Git%20Repository/flutter/packages/flutter/lib/src/widgets/binding.dart').
Try calling using ?. instead.
WidgetsBinding.instance.addObserver(this);
^^^^^^^^^^^
../../Flutter%20SDK/Flutter%20Git%20Repository/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.5.1/lib/src/widgets/TimerWidget.dart:59:29: Error: Method 'removeObserver' cannot be called on 'WidgetsBinding?' because it is potentially null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../Flutter%20SDK/Flutter%20Git%20Repository/flutter/packages/flutter/lib/src/widgets/binding.dart').
Try calling using ?. instead.
WidgetsBinding.instance.removeObserver(this);
^^^^^^^^^^^^^^
FAILURE: Build failed with an exception.
It seems you have missed null safety on WidgetsBinding
and SchedulerBinding
methods, causing the exception to be thrown. Can you get please provide a fix for this asap?
getting this issue with latest version
../programs/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.6.22/lib/src/extensions/string_extensions.dart:112:3: Error: Type 'Color' not found.
Color toColor({Color? defaultColor}) {
^^^^^
../programs/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.6.22/lib/src/extensions/string_extensions.dart:112:18: Error: Type 'Color' not found.
Color toColor({Color? defaultColor}) {
^^^^^
../programs/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.6.22/lib/src/extensions/string_extensions.dart:112:18: Error: 'Color' isn't a type.
Color toColor({Color? defaultColor}) {
^^^^^
Is this package support Dart 3 compatible? I couldn't see that badge in pub.dev
the function is expected to return true only if the dateTime refers to Today only, while it returns true for same day but different month and year.
I know it is a simple thing but the function name gives that expectation.
Thank You.
snackBar method not setting duration that passed through arguements
The duration is always the default duration
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: LateInitializationError: Field 'sharedPreferences' has not been initialized.
onAccept of showConfirmDialogCustom throw new NoSuchMethodError.withInvocation(this, invocation);
Hello,
how can I add showConfirmDialogCustom (or other Dialog) inside onAccept function of another showConfirmDialogCustom ?
Thank you
Hello,
First of all; great package. It's very useful!
I noticed a mistake.
/// Returns true if given date is yesterday
bool get isYesterday {
final now = DateTime.now();
final yesterday = DateTime(now.year, now.month, now.day - 1);
return DateTime(now.year, now.month, now.day - 1) == yesterday;
}
I think it should be something like this.
/// Returns true if given date is yesterday
bool get isYesterday {
final now = DateTime.now();
final yesterday = DateTime(now.year, now.month, now.day - 1);
return DateTime(this.year, this.month, this.day) == yesterday;
}
Thanks!
There is an error when trying to install nb_utils because the string in s.summary contains an
apostrophe without escaping.
Pod::Spec.new do |s|
s.name = 'nb_utils'
s.version = '0.0.1'
s.summary = 'This package helps you daily usable function with ease. Just add nb_utils with its latest version and that's it you are ready to use.'
s.description = <<-DESC
The argument type 'Duration?'
can't be assigned to the parameter type 'Duration' because 'Duration?' is nullable and 'Duration' isn't.
Hello im using Flutter 3.0.0 with nb_utils: ^4.6.22 and i get this error
../../../../fvm/versions/flutter3.0.0/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.6.22/lib/src/extensions/string_extensions.dart:112:3: Error: Type 'Color' not found. Color toColor({Color? defaultColor}) { ^^^^^
Please Explain How to remove Shared Preferences value
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher.
The following dependencies do not satisfy the required version:
project ':nb_utils' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50
Hi, I'm unable to build the app when I am using nb_utils. I've tried creating a new project, installed nb_utils and followed the instructions on pub.dev to initialise it in the main.dart. However, build fails with the following error:
Launching lib/main.dart on iPhone 14 Pro in debug mode...
main.dart:1
Xcode build done. 14.1s
Connecting to VM Service at ws://127.0.0.1:52006/pXQGtIdn3rE=/ws
: Error: Type 'EditableTextContextMenuBuilder' not found.
app_text_field.dart:65
final EditableTextContextMenuBuilder? contextMenuBuilder;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: Error: 'EditableTextContextMenuBuilder' isn't a type.
app_text_field.dart:65
final EditableTextContextMenuBuilder? contextMenuBuilder;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: Error: No named parameter with the name 'contextMenuBuilder'.
app_text_field.dart:353
contextMenuBuilder: widget.contextMenuBuilder,
^^^^^^^^^^^^^^^^^^
: Context: Found this candidate, but the arguments don't match.
text_form_field.dart:97
TextFormField({
^^^^^^^^^^^^^
: Error: Method 'insert' cannot be called on 'OverlayState?' because it is potentially null.
overlay_custom_widget.dart:99
- 'OverlayState' is from 'package:flutter/src/widgets/overlay.dart' ('../../../Documents/dev/flutter/packages/flutter/lib/src/widgets/overlay.dart').
overlay.dart:1
Try calling using ?. instead.
Overlay.of(context).insert(entry);
^^^^^^
Can you a screenshot of your code?
Originally posted by @bhoominn in #14 (comment)
Hi friends, thanks for your great package, I'm using AnimatedListView
and I want to scrollTo specific item in list, how can I get the specific item position in list, I tried a lot of things nothing seems to work :( if I'm using jumpTo how I can get the "item pos" when my items in list have different heights? Thanks in advanced!
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/nb_utils-5.0.5/lib/src/widgets/app_text_field.dart:65:9: Error: Type 'EditableTextContextMenuBuilder' not found.
final EditableTextContextMenuBuilder? contextMenuBuilder;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/nb_utils-5.0.5/lib/src/widgets/app_text_field.dart:65:9: Error: 'EditableTextContextMenuBuilder' isn't a type.
final EditableTextContextMenuBuilder? contextMenuBuilder;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/nb_utils-5.0.5/lib/src/widgets/app_text_field.dart:353:7: Error: No named parameter with the name 'contextMenuBuilder'.
contextMenuBuilder: widget.contextMenuBuilder,
^^^^^^^^^^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/material/text_form_field.dart:97:3: Context: Found this candidate, but the arguments don't match.
TextFormField({
^^^^^^^^^^^^^
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/nb_utils-5.0.5/lib/src/widgets/overlay_custom_widget.dart:99:25: Error: Method 'insert' cannot be called on 'OverlayState?' because it is potentially null.
Error when trying to run flutter on iOS.
../flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.6.21/lib/src/utils/common.dart:67:20: Error: The argument type 'Duration?' can't be assigned to the parameter type 'Duration' because 'Duration?' is nullable and 'Duration' isn't. - 'Duration' is from 'dart:core'. toastDuration: duration,
Hi,
can you upgrade the flutter version because some dependencies on this library is not updated to be compatible with the new Flutter version .
Kind regards
Hi friends, thanks for your great package, I'm using it and it is showing error , I tried a lot of things nothing seems to work :( .
Hello, I'm facing an issue with this package. This is the error I'm getting. Kindly, help me asap.
The plugin nb_utils
doesn't have a main class defined in
E:\development\flutter.pub-cache\hosted\pub.dartlang.org\nb_utils-4.4.9\android\src\main\java\com\nb\nb_utils\NbUtilsPlugin.java or
E:\development\flutter.pub-cache\hosted\pub.dartlang.org\nb_utils-4.4.9\android\src\main\kotlin\com\nb\nb_utils\NbUtilsPlugin.kt. This is likely to due to an incorrect androidPackage: com.nb.nb_utils
or mainClass
entry inthe plugin's pubspec.yaml.
If you are the author of this plugin, fix the androidPackage
entry or move the main class to any of locations
used above. Otherwise, please contact the author of this plugin and consider using a different plugin in the
meanwhile.
[ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: LateInitializationError: Field 'sharedPreferences' has not been initialized.
E/flutter ( 7771): #0 sharedPreferences (package:nb_utils/nb_utils.dart)
E/flutter ( 7771): #1 getStringAsync (package:nb_utils/src/utils/shared_pref.dart:68:10)
Hi, I am getting this error when using the latest packages.
Because nb_utils 4.6.22 depends on connectivity_plus ^2.3.9 and no versions of nb_utils match >4.6.22 <5.0.0, nb_utils ^4.6.22 requires connectivity_plus ^2.3.9.
log('Your string'); //Big Data Full print problem
import nb_utils package any page .. than not add import 'dart:developer';
example ---
import 'package:nb_utils/nb_utils.dart';
import 'dart:developer'; // import problem
log('data: $data');
C:\Users\*********\android\app\src\debug\AndroidManifest.xml Error:
uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [:nb_utils] C:\Users\**************\build\nb_utils\intermediates\merged_manifest\debug\AndroidManifest.xml as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 21,
or use tools:overrideLibrary="com.nb.nb_utils" to force usage (may lead to runtime failures)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [:nb_utils]
Hi, when facing such a problem here is how to fix it.
change your minSdkVersion under app/build.grade to 21 or higher
Then run Flutter clean and run your project
build.gradle needs namespace:
android { namespace "com.nb.nb_utils" }
Hi, thank you for your efforts..
I am depending on v 4.5.2 because of this issue
Flutter 2.8.1
I am facing an error on app run :
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/nb_utils-4.5.2/lib/src/utils/system_utils.dart:156:5: Error: No named parameter with the name 'useMaterial3'.
useMaterial3: true,
^^^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/material/theme_data.dart:222:11: Context: Found this candidate, but the arguments don't match.
factory ThemeData({
^
and build is failed.
This is showing with the last version as well.
Error: Method 'insert' cannot be called on 'OverlayState?' because it is potentially null.
../…/widgets/overlay_custom_widget.dart:99
FAILURE: Build completed with 2 failures.
Here is the flutter doctor Summary
[✓] Flutter (Channel stable, 3.3.7, on macOS 13.1 22C5033e darwin-arm, locale en-PK)
• Flutter version 3.3.7 on channel stable at /Users/admin/Downloads/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision e99c9c7cd9 (3 months ago), 2022-11-01 16:59:00 -0700
• Engine revision 857bd6b74c
• Dart version 2.18.4
• DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc1)
• Android SDK at /Users/admin/Library/Android/sdk
• Platform android-33, build-tools 33.0.0-rc1
• ANDROID_HOME = /Users/admin/Library/Android/sdk
• ANDROID_SDK_ROOT = /Users/admin/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14C18
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
[✓] VS Code (version 1.74.3)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.58.0
[✓] Connected device (3 available)
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 12 (API 32) (emulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 13.1 22C5033e darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome 109.0.5414.119
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Execution failed for task ':nb_utils:compileDebugKotlin'.
'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.
Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain
D:\Portfolio\Project\auto_localization_maker\windows\flutter\generated_plugin_registrant.cc(13,3): error C3861: 'nb_utils_pluginRegisterWithRegistrar': identifier not found [D:\Portfolio\Project\auto_localization_maker\build\windows\runner\auto_localization_maker.vcxproj]
Exception: Build process failed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.