- 
                Notifications
    You must be signed in to change notification settings 
- Fork 169
Migrate project to Dart 3 #262
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
          
     Open
      
      
            orestesgaolin
  wants to merge
  6
  commits into
  fluttercommunity:main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
orestesgaolin:update-to-dart-3
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Changes from 5 commits
      Commits
    
    
            Show all changes
          
          
            6 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      a9ebd6d
              
                chore: update gitignore to include lock files
              
              
                orestesgaolin f084675
              
                refactor: migrate to dart 3 and update example app
              
              
                orestesgaolin 5f8d987
              
                chore: use enum for status key
              
              
                orestesgaolin 9279146
              
                docs: update readme and changelog
              
              
                orestesgaolin f9bb28a
              
                docs: update example backend config
              
              
                orestesgaolin 819307e
              
                chore: apply PR suggestions
              
              
                orestesgaolin File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,39 +1,23 @@ | ||
| # flutter_uploader_example | ||
|  | ||
| Demonstrates how to use the flutter_uploader plugin. | ||
| Demonstrates how to use the `flutter_uploader` plugin. This example includes two basic cloud function endpoints to receive the uploaded files that can be deployed locally or on Firebase. | ||
|  | ||
| ## Getting Started | ||
| ## Getting Started - Flutter | ||
|  | ||
| # Setup upload Api | ||
| To run the app on **iOS** make sure to update signing configuration to use your development certificate. On **Android** you don't need to do any additional setup to run the example app. | ||
|  | ||
| 1. install firebase-tools in terminal | ||
| In the `lib/main.dart` you can define the `uploadURL` to point to your own cloud function (e.g. `http://192.168.1.xx:5001/flutteruploader/us-central1/upload` when running emulator on computer located at `192.168.1.xx` in the local network, needs to match `firebase.json` emulator config). | ||
|  | ||
| ```console | ||
| npm install -g firebase-tools | ||
| ``` | ||
|  | ||
| 2. create project in firebase console | ||
|  | ||
| 3. login to firebase in terminal | ||
|  | ||
| ```console | ||
| firebase login | ||
| ``` | ||
| On Android you need to manually grant notifications permissions in system settings to see the updates in notification panel. The example app does not prompt for notifications permissions on Android. | ||
|  | ||
| 4. Go to example/backend/ | ||
| ## Setup Upload Api | ||
|  | ||
| 5. run | ||
|  | ||
| ```console | ||
| firebase deploy | ||
| ``` | ||
|  | ||
| 6. run example app | ||
| See [backend/README.md](backend/README.md) for instructions on how to setup the cloud functions locally or on Firebase. | ||
|  | ||
| ## Driver tests | ||
|  | ||
| Run the current end to end test suite: | ||
|  | ||
| ``` | ||
| flutter drive --driver=test_driver/flutter_uploader_e2e_test.dart test_driver/flutter_uploader_test.dart | ||
| ``` | ||
| ``` | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| linter: | ||
| rules: | ||
| public_member_api_docs: false | ||
| avoid_print: false | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,3 +1,10 @@ | ||
| plugins { | ||
| id "com.android.application" | ||
| id "kotlin-android" | ||
| id "dev.flutter.flutter-gradle-plugin" | ||
| } | ||
|  | ||
|  | ||
| def localProperties = new Properties() | ||
| def localPropertiesFile = rootProject.file('local.properties') | ||
| if (localPropertiesFile.exists()) { | ||
|  | @@ -6,11 +13,6 @@ if (localPropertiesFile.exists()) { | |
| } | ||
| } | ||
|  | ||
| def flutterRoot = localProperties.getProperty('flutter.sdk') | ||
| if (flutterRoot == null) { | ||
| throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") | ||
| } | ||
|  | ||
| def flutterVersionCode = localProperties.getProperty('flutter.versionCode') | ||
| if (flutterVersionCode == null) { | ||
| flutterVersionCode = '1' | ||
|  | @@ -21,29 +23,38 @@ if (flutterVersionName == null) { | |
| flutterVersionName = '1.0' | ||
| } | ||
|  | ||
| apply plugin: 'com.android.application' | ||
| apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" | ||
| def keystoreProperties = new Properties() | ||
| def keystorePropertiesFile = rootProject.file('key.properties') | ||
| if (keystorePropertiesFile.exists()) { | ||
| keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) | ||
| } | ||
|  | ||
| android { | ||
| compileSdkVersion 31 | ||
| namespace "com.bluechilli.flutteruploaderexample" | ||
| ndkVersion flutter.ndkVersion | ||
| compileSdk 34 | ||
|  | ||
| lintOptions { | ||
| disable 'InvalidPackage' | ||
| compileOptions { | ||
| sourceCompatibility JavaVersion.VERSION_17 | ||
| targetCompatibility JavaVersion.VERSION_17 | ||
| } | ||
|  | ||
| compileOptions { | ||
| sourceCompatibility JavaVersion.VERSION_1_8 | ||
| targetCompatibility JavaVersion.VERSION_1_8 | ||
| kotlinOptions { | ||
| jvmTarget = JavaVersion.VERSION_17 | ||
| } | ||
|  | ||
| sourceSets { | ||
| main.java.srcDirs += 'src/main/kotlin' | ||
| } | ||
|  | ||
| defaultConfig { | ||
| // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). | ||
| applicationId "com.bluechilli.flutteruploaderexample" | ||
| minSdkVersion 16 | ||
| targetSdkVersion 31 | ||
| minSdkVersion flutter.minSdkVersion | ||
| targetSdkVersion 34 | ||
| versionCode flutterVersionCode.toInteger() | ||
| versionName flutterVersionName | ||
| testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
| multiDexEnabled true | ||
|         
                  orestesgaolin marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| } | ||
|  | ||
| buildTypes { | ||
|  | @@ -62,8 +73,4 @@ flutter { | |
| dependencies { | ||
| def multidex_version = "2.0.1" | ||
| implementation "androidx.multidex:multidex:$multidex_version" | ||
|          | ||
|  | ||
| testImplementation 'junit:junit:4.13.1' | ||
| androidTestImplementation 'androidx.test:runner:1.2.0' | ||
| androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' | ||
| } | ||
| } | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,61 +1,69 @@ | ||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
| xmlns:tools="http://schemas.android.com/tools" | ||
| package="com.bluechilli.flutteruploaderexample"> | ||
| xmlns:tools="http://schemas.android.com/tools" | ||
| package="com.bluechilli.flutteruploaderexample"> | ||
|  | ||
| <uses-permission android:name="android.permission.INTERNET" /> | ||
| <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | ||
| <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
| <uses-permission android:name="android.permission.INTERNET" /> | ||
| <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | ||
| <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
|  | ||
| <!-- io.flutter.app.FlutterApplication is an android.app.Application that | ||
| calls FlutterMain.startInitialization(this); in its onCreate method. | ||
| In most cases you can leave this as-is, but you if you want to provide | ||
| additional functionality it is fine to subclass or reimplement | ||
| FlutterApplication and put your custom class here. --> | ||
| <application | ||
| android:name="${applicationName}" | ||
| android:icon="@mipmap/ic_launcher" | ||
| android:label="flutter_uploader_example" | ||
| android:networkSecurityConfig="@xml/network_security_config" | ||
| tools:ignore="GoogleAppIndexingWarning"> | ||
| <activity | ||
| android:name="io.flutter.embedding.android.FlutterActivity" | ||
| android:launchMode="singleTop" | ||
| android:theme="@style/LaunchTheme" | ||
| android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" | ||
| android:hardwareAccelerated="true" | ||
| android:windowSoftInputMode="adjustResize" | ||
| android:exported="true"> | ||
| <!-- This keeps the window background of the activity showing | ||
| until Flutter renders its first frame. It can be removed if | ||
| there is no splash screen (such as the default splash screen | ||
| defined in @style/LaunchTheme). --> | ||
| <meta-data | ||
| android:name="io.flutter.app.android.SplashScreenUntilFirstFrame" | ||
| android:value="true" /> | ||
| <intent-filter> | ||
| <action android:name="android.intent.action.MAIN"/> | ||
| <category android:name="android.intent.category.LAUNCHER"/> | ||
| </intent-filter> | ||
| </activity> | ||
| <!-- io.flutter.app.FlutterApplication is an android.app.Application that | ||
| calls FlutterMain.startInitialization(this); in its onCreate method. | ||
| In most cases you can leave this as-is, but you if you want to provide | ||
| additional functionality it is fine to subclass or reimplement | ||
| FlutterApplication and put your custom class here. --> | ||
| <application | ||
| android:name="${applicationName}" | ||
| android:icon="@mipmap/ic_launcher" | ||
| android:label="flutter_uploader_example" | ||
| android:networkSecurityConfig="@xml/network_security_config" | ||
| tools:ignore="GoogleAppIndexingWarning"> | ||
| <activity | ||
| android:name="io.flutter.embedding.android.FlutterActivity" | ||
| android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" | ||
| android:exported="true" | ||
| android:hardwareAccelerated="true" | ||
| android:launchMode="singleTop" | ||
| android:theme="@style/LaunchTheme" | ||
| android:windowSoftInputMode="adjustResize"> | ||
| <!-- This keeps the window background of the activity showing | ||
| until Flutter renders its first frame. It can be removed if | ||
| there is no splash screen (such as the default splash screen | ||
| defined in @style/LaunchTheme). --> | ||
| <meta-data | ||
| android:name="io.flutter.app.android.SplashScreenUntilFirstFrame" | ||
| android:value="true" /> | ||
| <intent-filter> | ||
| <action android:name="android.intent.action.MAIN" /> | ||
| <category android:name="android.intent.category.LAUNCHER" /> | ||
| </intent-filter> | ||
| </activity> | ||
|  | ||
| <provider | ||
| android:name="androidx.work.impl.WorkManagerInitializer" | ||
| android:authorities="${applicationId}.workmanager-init" | ||
| android:enabled="false" | ||
| android:exported="false" /> | ||
| <provider | ||
| android:name="androidx.startup.InitializationProvider" | ||
| android:authorities="${applicationId}.androidx-startup" | ||
| android:enabled="false" | ||
| android:exported="false" | ||
| tools:node="merge"> | ||
| <meta-data | ||
| android:name="androidx.work.WorkManagerInitializer" | ||
| android:enabled="false" | ||
| android:exported="false" | ||
| android:value="androidx.startup" /> | ||
| </provider> | ||
| <provider | ||
| android:name="com.bluechilli.flutteruploader.FlutterUploaderInitializer" | ||
| android:authorities="${applicationId}.flutter-uploader-init" | ||
| android:exported="false"> | ||
| <meta-data | ||
| android:name="com.bluechilli.flutteruploader.MAX_CONCURRENT_TASKS" | ||
| android:value="2" /> | ||
| <meta-data | ||
| android:name="com.bluechilli.flutteruploader.UPLOAD_CONNECTION_TIMEOUT_IN_SECONDS" | ||
| android:value="3600" /> | ||
| </provider> | ||
|  | ||
| <provider | ||
| android:name="com.bluechilli.flutteruploader.FlutterUploaderInitializer" | ||
| android:authorities="${applicationId}.flutter-uploader-init" | ||
| android:exported="false"> | ||
| <meta-data | ||
| android:name="com.bluechilli.flutteruploader.MAX_CONCURRENT_TASKS" | ||
| android:value="5" /> | ||
| <meta-data | ||
| android:name="com.bluechilli.flutteruploader.UPLOAD_CONNECTION_TIMEOUT_IN_SECONDS" | ||
| android:value="3600" /> | ||
| </provider> | ||
|  | ||
| <meta-data android:name="flutterEmbedding" android:value="2"/> | ||
| </application> | ||
| <meta-data | ||
| android:name="flutterEmbedding" | ||
| android:value="2" /> | ||
| </application> | ||
| </manifest> | 
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should increase the agp plugin, I'd prefer to use the newest
8.5.0if flutter supports it, if not the highest supported version would be great